@topconsultnpm/sdkui-react-beta 6.15.68 → 6.15.71
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.
- package/lib/components/base/TMCounterContainer.d.ts +1 -0
- package/lib/components/base/TMCounterContainer.js +2 -0
- package/lib/components/base/TMDataGrid.js +24 -12
- package/lib/components/features/search/TMSavedQuerySelector.js +11 -1
- package/lib/components/features/search/TMTreeSelector.js +14 -0
- package/lib/components/grids/TMRecentsManager.js +10 -0
- package/package.json +1 -1
|
@@ -38,6 +38,8 @@ const Counter = styled.div `
|
|
|
38
38
|
/* Enum for possible counter item keys */
|
|
39
39
|
export var CounterItemKey;
|
|
40
40
|
(function (CounterItemKey) {
|
|
41
|
+
/* Key for all item count */
|
|
42
|
+
CounterItemKey["allItems"] = "allItems";
|
|
41
43
|
/* Key for visible item count */
|
|
42
44
|
CounterItemKey["visibleItems"] = "visibleItems";
|
|
43
45
|
/* Key for selected item count */
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
3
3
|
import DataGrid, { Column, HeaderFilter, Selection, Scrolling, LoadPanel, SearchPanel, Pager, Sorting, Paging, FilterPanel, ColumnChooser, Grouping, GroupPanel, Summary, Editing, FilterRow, StateStoring, RowDragging, MasterDetail } from 'devextreme-react/data-grid';
|
|
4
4
|
import DataSource from 'devextreme/data/data_source';
|
|
5
|
-
import { IconSelected, IconVisible, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
|
|
5
|
+
import { IconAll, IconSelected, IconVisible, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
|
|
6
6
|
import TMCounterContainer, { CounterItemKey } from './TMCounterContainer';
|
|
7
7
|
;
|
|
8
8
|
export var TMDataGridPageSize;
|
|
@@ -26,19 +26,24 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
26
26
|
const internalRef = React.useRef(null);
|
|
27
27
|
useImperativeHandle(ref, () => internalRef.current);
|
|
28
28
|
const [counterValues, setCounterValues] = useState(new Map());
|
|
29
|
-
const [
|
|
29
|
+
const [totalRecordCount, setTotalRecordCount] = useState(0);
|
|
30
|
+
const [visibleItemsCount, setVisibleItemsCount] = useState(0);
|
|
30
31
|
useEffect(() => {
|
|
31
32
|
const count = getRecordCount(dataSource);
|
|
32
|
-
|
|
33
|
+
setTotalRecordCount(count);
|
|
33
34
|
}, [dataSource]);
|
|
34
35
|
// Creating a ref to store the timestamp of the last selection change
|
|
35
36
|
const lastSelectionChangeTime = useRef(Date.now());
|
|
36
37
|
useEffect(() => {
|
|
37
38
|
if (counterConfig.show) {
|
|
38
39
|
const defaultCounterItems = new Map([
|
|
40
|
+
[
|
|
41
|
+
CounterItemKey.allItems,
|
|
42
|
+
{ key: CounterItemKey.allItems, show: true, caption: SDKUI_Localizator.All, value: totalRecordCount, icon: _jsx(IconAll, {}), order: -1 }
|
|
43
|
+
],
|
|
39
44
|
[
|
|
40
45
|
CounterItemKey.visibleItems,
|
|
41
|
-
{ key: CounterItemKey.visibleItems, show: true, caption: SDKUI_Localizator.VisibleItems, value:
|
|
46
|
+
{ key: CounterItemKey.visibleItems, show: true, caption: SDKUI_Localizator.VisibleItems, value: visibleItemsCount, icon: _jsx(IconVisible, {}), order: 0 }
|
|
42
47
|
],
|
|
43
48
|
[
|
|
44
49
|
CounterItemKey.selectedItems,
|
|
@@ -59,7 +64,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
59
64
|
}));
|
|
60
65
|
setCounterValues(sortedCounterItems);
|
|
61
66
|
}
|
|
62
|
-
}, [counterConfig,
|
|
67
|
+
}, [counterConfig, visibleItemsCount, selectedRowKeys]);
|
|
63
68
|
// Handle selection changes and invoke callback if provided
|
|
64
69
|
const onSelectionChangedCallback = useCallback((e) => {
|
|
65
70
|
lastSelectionChangeTime.current = Date.now(); // Store current time of selection change
|
|
@@ -153,21 +158,28 @@ const TMDataGrid = React.forwardRef((props, ref) => {
|
|
|
153
158
|
});
|
|
154
159
|
}
|
|
155
160
|
}, [showSearchPanel, searchPanelToolbarPosition]);
|
|
156
|
-
|
|
161
|
+
// Memoized callback that runs when the DataGrid content is ready
|
|
162
|
+
const onContentReadyCallback = useCallback((e) => {
|
|
163
|
+
// If event is undefined, exit early (safety check)
|
|
164
|
+
if (e === undefined)
|
|
165
|
+
return;
|
|
166
|
+
// Call the external onContentReady callback if it was provided
|
|
157
167
|
onContentReady?.(e);
|
|
158
|
-
|
|
159
|
-
if(
|
|
160
|
-
|
|
161
|
-
|
|
168
|
+
// If ref to the DataGrid is not set yet, exit early
|
|
169
|
+
if (!internalRef.current)
|
|
170
|
+
return;
|
|
171
|
+
// Update state with the current number of visible rows in the DataGrid
|
|
172
|
+
setVisibleItemsCount(internalRef.current.instance().getVisibleRows().length);
|
|
173
|
+
}, [onContentReady]);
|
|
162
174
|
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { style: { width: "100%", height: counterConfig.show ? "calc(100% - 25px)" : "100%" }, children: _jsxs(DataGrid, { ref: internalRef, id: id, className: 'tm-datagrid',
|
|
163
175
|
// main properties
|
|
164
176
|
keyExpr: keyExpr, dataSource: dataSource, selectedRowKeys: selectedRowKeys, focusedRowEnabled: focusedRowEnabled, hoverStateEnabled: hoverStateEnabled,
|
|
165
177
|
// events and callbacks
|
|
166
|
-
onSelectionChanged: onSelectionChangedCallback, onRowDblClick: onRowDblClickCallback, onRowPrepared: onRowPrepared, onContextMenuPreparing: onContextMenuPreparingCallback, onToolbarPreparing: onToolbarPreparingCallback, onFocusedRowChanged: onFocusedRowChanged, onRowClick: onRowClick, onCellClick: onCellClick, onCellDblClick: onCellDblClick, onOptionChanged: onOptionChanged, onContentReady:
|
|
178
|
+
onSelectionChanged: onSelectionChangedCallback, onRowDblClick: onRowDblClickCallback, onRowPrepared: onRowPrepared, onContextMenuPreparing: onContextMenuPreparingCallback, onToolbarPreparing: onToolbarPreparingCallback, onFocusedRowChanged: onFocusedRowChanged, onRowClick: onRowClick, onCellClick: onCellClick, onCellDblClick: onCellDblClick, onOptionChanged: onOptionChanged, onContentReady: onContentReadyCallback, onInitialized: onInitialized, customizeColumns: customizeColumns, onEditorPreparing: onEditorPreparing, onCellPrepared: onCellPrepared, onRowUpdating: onRowUpdating, onRowExpanded: onRowExpanded, onRowCollapsed: onRowCollapsed, onRowUpdated: onRowUpdated, onSaved: onSaved, onEditCanceled: onEditCanceled, onEditingStart: onEditingStart, onEditingChange: onEditingChange, onKeyDown: onKeyDown,
|
|
167
179
|
// other properties
|
|
168
180
|
disabled: disabled, autoNavigateToFocusedRow: autoNavigateToFocusedRow, focusedRowKey: focusedRowKey, columnHidingEnabled: columnHidingEnabled, columnResizingMode: columnResizingMode, columnAutoWidth: columnAutoWidth, allowColumnResizing: allowColumnResizing, allowColumnReordering: allowColumnReordering, showBorders: showBorders, showRowLines: showRowLines, showColumnLines: showColumnLines, showColumnHeaders: showColumnHeaders, rowAlternationEnabled: rowAlternationEnabled, wordWrapEnabled: wordWrapEnabled, noDataText: noDataText,
|
|
169
181
|
// styles
|
|
170
|
-
width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), columnChooser && _jsx(ColumnChooser, { ...columnChooser }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible:
|
|
182
|
+
width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), columnChooser && _jsx(ColumnChooser, { ...columnChooser }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible: totalRecordCount > pageSize }), masterDetail && _jsx(MasterDetail, { ...masterDetail })] }) }), counterConfig.show && _jsx("div", { style: { width: "100%", height: "25px", display: "flex", alignItems: "center", gap: "15px", backgroundColor: "#e0e0e0" }, children: _jsx(TMCounterContainer, { items: counterValues, bgColorContainer: counterConfig.bgColorContainer, bgColorItem: counterConfig.bgColorItem, hoverColorItem: counterConfig.hoverColorItem, textColorItem: counterConfig.textColorItem }) })] });
|
|
171
183
|
});
|
|
172
184
|
export default TMDataGrid;
|
|
173
185
|
const getRecordCount = (dataSource) => {
|
|
@@ -25,8 +25,18 @@ const StyledSqdItem = styled.div `
|
|
|
25
25
|
white-space: nowrap;
|
|
26
26
|
text-overflow: ellipsis;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
&:hover {
|
|
29
29
|
cursor: pointer;
|
|
30
|
+
background: linear-gradient(
|
|
31
|
+
270deg,
|
|
32
|
+
rgba(70, 181, 162, 0.15) 16%,
|
|
33
|
+
rgba(59, 170, 188, 0.15) 34%,
|
|
34
|
+
rgba(59, 170, 188, 0.15) 34%,
|
|
35
|
+
rgba(54, 129, 173, 0.15) 54%,
|
|
36
|
+
rgba(51, 104, 165, 0.15) 72%,
|
|
37
|
+
rgba(47, 84, 157, 0.15) 88%,
|
|
38
|
+
rgba(48, 79, 153, 0.15) 100%
|
|
39
|
+
);
|
|
30
40
|
}
|
|
31
41
|
|
|
32
42
|
.info-icon {
|
|
@@ -286,4 +286,18 @@ const StyledTreeListWrapper = styled.div `
|
|
|
286
286
|
.dx-selection td {
|
|
287
287
|
background: oklch(from var(--dx-color-primary) l c h / .2) !important;
|
|
288
288
|
}
|
|
289
|
+
|
|
290
|
+
.dx-data-row:hover {
|
|
291
|
+
cursor: pointer;
|
|
292
|
+
background: linear-gradient(
|
|
293
|
+
270deg,
|
|
294
|
+
rgba(70, 181, 162, 0.15) 16%,
|
|
295
|
+
rgba(59, 170, 188, 0.15) 34%,
|
|
296
|
+
rgba(59, 170, 188, 0.15) 34%,
|
|
297
|
+
rgba(54, 129, 173, 0.15) 54%,
|
|
298
|
+
rgba(51, 104, 165, 0.15) 72%,
|
|
299
|
+
rgba(47, 84, 157, 0.15) 88%,
|
|
300
|
+
rgba(48, 79, 153, 0.15) 100%
|
|
301
|
+
);
|
|
302
|
+
}
|
|
289
303
|
`;
|
|
@@ -22,6 +22,16 @@ const StyledRecentTidItem = styled.div `
|
|
|
22
22
|
|
|
23
23
|
&:hover {
|
|
24
24
|
cursor: pointer;
|
|
25
|
+
background: linear-gradient(
|
|
26
|
+
270deg,
|
|
27
|
+
rgba(70, 181, 162, 0.15) 16%,
|
|
28
|
+
rgba(59, 170, 188, 0.15) 34%,
|
|
29
|
+
rgba(59, 170, 188, 0.15) 34%,
|
|
30
|
+
rgba(54, 129, 173, 0.15) 54%,
|
|
31
|
+
rgba(51, 104, 165, 0.15) 72%,
|
|
32
|
+
rgba(47, 84, 157, 0.15) 88%,
|
|
33
|
+
rgba(48, 79, 153, 0.15) 100%
|
|
34
|
+
);
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
.info-icon {
|