@progress/kendo-react-grid 5.17.0-dev.202308101804 → 5.17.0-dev.202308141334
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/dist/cdn/js/kendo-react-grid.js +1 -1
- package/dist/es/Grid.d.ts +2 -0
- package/dist/es/Grid.js +28 -14
- package/dist/es/drag/ColumnResize.d.ts +1 -0
- package/dist/es/drag/ColumnResize.js +46 -5
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/index.d.ts +5 -1
- package/dist/es/utils/index.js +11 -1
- package/dist/npm/Grid.d.ts +2 -0
- package/dist/npm/Grid.js +26 -12
- package/dist/npm/drag/ColumnResize.d.ts +1 -0
- package/dist/npm/drag/ColumnResize.js +46 -5
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/index.d.ts +5 -1
- package/dist/npm/utils/index.js +13 -2
- package/dist/systemjs/kendo-react-grid.js +1 -1
- package/package.json +18 -18
package/dist/es/Grid.d.ts
CHANGED
|
@@ -109,6 +109,8 @@ export declare class Grid extends React.Component<GridProps> {
|
|
|
109
109
|
private _columns;
|
|
110
110
|
private _columnsMap;
|
|
111
111
|
private _columnsMutations;
|
|
112
|
+
private _resized;
|
|
113
|
+
private _shouldUpdateLeftRight;
|
|
112
114
|
private contextStateRef;
|
|
113
115
|
private navigationStateRef;
|
|
114
116
|
private _data;
|
package/dist/es/Grid.js
CHANGED
|
@@ -36,7 +36,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
import * as React from 'react';
|
|
37
37
|
import * as PropTypes from 'prop-types';
|
|
38
38
|
import { dispatchEvent, classNames, getter, guid, setScrollbarWidth, canUseDOM, memoizeOne, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
39
|
-
import { tableColumnsVirtualization, Pager, mapColumns, isRtl, tableKeyboardNavigation, TableKeyboardNavigationContext, tableKeyboardNavigationScopeAttributes, tableKeyboardNavigationTools as navigationTools, tableKeyboardNavigationBodyAttributes, getSelectionOptions, TableSelection, DropClue, DragClue } from '@progress/kendo-react-data-tools';
|
|
39
|
+
import { tableColumnsVirtualization, Pager, mapColumns, updateLeft, updateRight, isRtl, tableKeyboardNavigation, TableKeyboardNavigationContext, tableKeyboardNavigationScopeAttributes, tableKeyboardNavigationTools as navigationTools, tableKeyboardNavigationBodyAttributes, getSelectionOptions, TableSelection, DropClue, DragClue } from '@progress/kendo-react-data-tools';
|
|
40
40
|
import { GridSelectionCell } from './cells/GridSelectionCell';
|
|
41
41
|
import { GridHierarchyCell } from './cells/GridHierarchyCell';
|
|
42
42
|
import { GridEditCell } from './cells/GridEditCell';
|
|
@@ -49,7 +49,7 @@ import { VirtualScroll } from './VirtualScroll';
|
|
|
49
49
|
import { RowHeightService, VirtualScrollFixed } from './VirtualScrollFixed';
|
|
50
50
|
import { ColumnResize } from './drag/ColumnResize';
|
|
51
51
|
import { CommonDragLogic } from './drag/CommonDragLogic';
|
|
52
|
-
import { getNestedValue, flatData, readColumns, autoGenerateColumns, firefox, firefoxMaxHeight, sanitizeColumns, resolveCells } from './utils/index';
|
|
52
|
+
import { getNestedValue, flatData, readColumns, autoGenerateColumns, firefox, firefoxMaxHeight, sanitizeColumns, resolveCells, getColumnWidth } from './utils/index';
|
|
53
53
|
import { GridCell } from './cells/GridCell';
|
|
54
54
|
import { GridGroupCell } from './cells/GridGroupCell';
|
|
55
55
|
import { GridRow } from './rows/GridRow';
|
|
@@ -101,6 +101,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
101
101
|
_this._columns = [];
|
|
102
102
|
_this._columnsMap = [[]];
|
|
103
103
|
_this._columnsMutations = 0;
|
|
104
|
+
_this._resized = false;
|
|
105
|
+
_this._shouldUpdateLeftRight = true;
|
|
104
106
|
_this.contextStateRef = { current: undefined };
|
|
105
107
|
_this.navigationStateRef = { current: undefined };
|
|
106
108
|
_this._data = [];
|
|
@@ -357,6 +359,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
357
359
|
};
|
|
358
360
|
_this.onResize = function (index, newWidth, oldWidth, nativeEvent, end, targetId) {
|
|
359
361
|
_this.resetTableWidth();
|
|
362
|
+
_this._shouldUpdateLeftRight = true;
|
|
363
|
+
_this._resized = true;
|
|
360
364
|
_this._columnsMutations++;
|
|
361
365
|
if (_this.props.onColumnResize) {
|
|
362
366
|
_this.props.onColumnResize.call(undefined, {
|
|
@@ -432,8 +436,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
432
436
|
}
|
|
433
437
|
columns.slice(columnIndexOffset).forEach(function (c) { return c.parentIndex >= 0 && (c.parentIndex += columnIndexOffset); });
|
|
434
438
|
});
|
|
435
|
-
_this.getHeaderRow = memoizeOne(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap) {
|
|
436
|
-
return (React.createElement(HeaderRow, { cells: _this.props.cells, sort: sort, sortable: sortable, sortChange: _this.sortChange, group: group || [], groupable: groupable, groupChange: _this.groupChange, filter: filter, filterable: filterable, filterOperators: filterOperators, filterChange: _this.filterChange, columnMenu: columnMenu, selectionChange: _this.onHeaderSelectionChange, columns: columns, columnResize: _this.columnResize, pressHandler: _this.dragLogic.pressHandler, dragHandler: _this.dragLogic.dragHandler, releaseHandler: _this.dragLogic.releaseHandler, columnsMap: columnsMap, cellRender: headerCellRender, isRtl:
|
|
439
|
+
_this.getHeaderRow = memoizeOne(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap, isHeaderRtl) {
|
|
440
|
+
return (React.createElement(HeaderRow, { cells: _this.props.cells, sort: sort, sortable: sortable, sortChange: _this.sortChange, group: group || [], groupable: groupable, groupChange: _this.groupChange, filter: filter, filterable: filterable, filterOperators: filterOperators, filterChange: _this.filterChange, columnMenu: columnMenu, selectionChange: _this.onHeaderSelectionChange, columns: columns, columnResize: _this.columnResize, pressHandler: _this.dragLogic.pressHandler, dragHandler: _this.dragLogic.dragHandler, releaseHandler: _this.dragLogic.releaseHandler, columnsMap: columnsMap, cellRender: headerCellRender, isRtl: isHeaderRtl, dragClue: _this.dragLogic.dragClueRef, headerRef: _this.headerElementRef, containerRef: _this.containerRef }));
|
|
437
441
|
});
|
|
438
442
|
_this.resolveTitle = function (field) {
|
|
439
443
|
var column = _this._columns.find(function (c) { return c.field === field; });
|
|
@@ -597,6 +601,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
597
601
|
Grid.prototype.render = function () {
|
|
598
602
|
var _a, _b, _c, _d;
|
|
599
603
|
var _this = this;
|
|
604
|
+
var _e;
|
|
600
605
|
var total = this.props.total || 0;
|
|
601
606
|
var idPrefix = navigationTools.getIdPrefix(this.navigationStateRef);
|
|
602
607
|
var propsData = [];
|
|
@@ -609,7 +614,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
609
614
|
total = total || this.props.data.total;
|
|
610
615
|
}
|
|
611
616
|
var groupingFooter = (typeof this.props.groupable === 'object') && this.props.groupable.footer || 'none';
|
|
612
|
-
var
|
|
617
|
+
var _f = this.flatData(propsData, groupingFooter, this.props.skip || 0, this.props.group, this.props.expandField, this.props.filter, this.props.sort), resolvedGroupsCount = _f.resolvedGroupsCount, flattedData = _f.flattedData;
|
|
613
618
|
this._data = flattedData;
|
|
614
619
|
var groupable = this.props.groupable === true ||
|
|
615
620
|
(typeof this.props.groupable === 'object') && this.props.groupable.enabled !== false;
|
|
@@ -626,17 +631,16 @@ var Grid = /** @class */ (function (_super) {
|
|
|
626
631
|
child.type.displayName === 'KendoReactGridNoRecords'; });
|
|
627
632
|
var leafColumns = this._columns.filter(function (c) { return c.children.length === 0; });
|
|
628
633
|
var groupingPanel = groupable && (React.createElement(GroupPanel, { group: this.props.group || [], groupChange: this.groupChange, pressHandler: this.dragLogic.pressHandler, dragHandler: this.dragLogic.dragHandler, releaseHandler: this.dragLogic.releaseHandler, refCallback: this.dragLogic.refGroupPanelDiv, resolveTitle: this.resolveTitle }));
|
|
629
|
-
var
|
|
630
|
-
var header = (React.createElement(Header, { size: this.props.size, columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', scrollableDataElement: function () { return _this.vs.container; }, draggable: this.props.reorderable || groupable, ref: this.headerRef, elemRef: this.headerElementRef, headerRow: this.getHeaderRow(sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, this._columns, this._columnsMap), filterRow: this.props.filterable && React.createElement(FilterRow, { cells: this.props.cells, size: this.props.size, columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || operators, filterChange: this.filterChange, sort: this.props.sort, cellRender: this.props.filterCellRender, isRtl: this.isRtl, ariaRowIndex: this._columnsMap.length + 1 }) || undefined, cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: column
|
|
631
|
-
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); }) }));
|
|
634
|
+
var _g = this.props, sort = _g.sort, sortable = _g.sortable, group = _g.group, filter = _g.filter, filterable = _g.filterable, _h = _g.filterOperators, filterOperators = _h === void 0 ? operators : _h, headerCellRender = _g.headerCellRender, columnMenu = _g.columnMenu;
|
|
635
|
+
var header = (React.createElement(Header, { size: this.props.size, columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', scrollableDataElement: function () { return _this.vs.container; }, draggable: this.props.reorderable || groupable, ref: this.headerRef, elemRef: this.headerElementRef, headerRow: this.getHeaderRow(sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, this._columns, this._columnsMap, this.isRtl), filterRow: this.props.filterable && React.createElement(FilterRow, { cells: this.props.cells, size: this.props.size, columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || operators, filterChange: this.filterChange, sort: this.props.sort, cellRender: this.props.filterCellRender, isRtl: this.isRtl, ariaRowIndex: this._columnsMap.length + 1 }) || undefined, cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: getColumnWidth(column) })); }) }));
|
|
632
636
|
var scrollLeft = this.vs && this.vs.container && this.vs.container.scrollLeft || 0;
|
|
633
637
|
var tableWidth = parseFloat(((this.props.style || {}).width || '').toString());
|
|
634
|
-
var
|
|
638
|
+
var _j = tableColumnsVirtualization({
|
|
635
639
|
enabled: this.props.columnVirtualization,
|
|
636
640
|
columns: leafColumns,
|
|
637
641
|
tableViewPortWidth: tableWidth,
|
|
638
642
|
scrollLeft: scrollLeft
|
|
639
|
-
}), colSpans =
|
|
643
|
+
}), colSpans = _j.colSpans, isColHidden = _j.hiddenColumns;
|
|
640
644
|
var dataRow = function (item, rowId, rowDataIndex) {
|
|
641
645
|
var isInEdit = false;
|
|
642
646
|
var selectedValue = _this.props.selectedField ? getNestedValue(_this.props.selectedField, item.dataItem) : undefined;
|
|
@@ -741,12 +745,15 @@ var Grid = /** @class */ (function (_super) {
|
|
|
741
745
|
var sorted = function (field) {
|
|
742
746
|
return _this.props.sort && _this.props.sort.filter(function (descriptor) { return descriptor.field === field; }).length > 0;
|
|
743
747
|
};
|
|
744
|
-
var
|
|
745
|
-
|
|
748
|
+
var footerCols = function (column, index) {
|
|
749
|
+
return (React.createElement("col", { key: index.toString(), width: getColumnWidth(column) }));
|
|
750
|
+
};
|
|
751
|
+
var footer = (Boolean((_e = this.props.cells) === null || _e === void 0 ? void 0 : _e.footerCell)
|
|
752
|
+
|| this._columns.some(function (c) { var _a; return Boolean(c.footerCell || Boolean((_a = c.cells) === null || _a === void 0 ? void 0 : _a.footerCell)); }))
|
|
753
|
+
? (React.createElement(Footer, { size: this.props.size, columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', ref: function (f) { return _this._footer = f; }, row: React.createElement(FooterRow, { cells: this.props.cells, columns: this._columns, isRtl: this.isRtl, ariaRowIndex: currentAriaRowIndex + 1 }), cols: leafColumns.map(footerCols) })) : null;
|
|
746
754
|
var colGroups = (React.createElement("colgroup", { ref: function (c) {
|
|
747
755
|
_this.columnResize.colGroupMain = c;
|
|
748
|
-
} }, leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), className: sorted(column.field) ? 'k-sorted' : undefined, width: column
|
|
749
|
-
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); })));
|
|
756
|
+
} }, leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), className: sorted(column.field) ? 'k-sorted' : undefined, width: getColumnWidth(column) })); })));
|
|
750
757
|
var enableDragClues = this.dragLogic.reorderable || this.dragLogic.groupable;
|
|
751
758
|
var tableDisplay = this.props.columnVirtualization ? 'block' : 'table';
|
|
752
759
|
if (this.props.scrollable === 'none') {
|
|
@@ -846,6 +853,13 @@ var Grid = /** @class */ (function (_super) {
|
|
|
846
853
|
(_a = this._columns).splice.apply(_a, __spreadArray([prev < next ? end(next - spliced.length) : next, 0], spliced, false));
|
|
847
854
|
this._columns.filter(function (q) { return q.declarationIndex >= 0; }).forEach(function (c, i) { return c.orderIndex = i; });
|
|
848
855
|
this._columnsMutations++;
|
|
856
|
+
var shouldUpdateRL = this._columns[prev].locked && this._columns[next].locked;
|
|
857
|
+
updateLeft(this._columnsMap, this._columns, shouldUpdateRL || this._shouldUpdateLeftRight);
|
|
858
|
+
updateRight(this._columnsMap, this._columns, shouldUpdateRL || this._shouldUpdateLeftRight);
|
|
859
|
+
if (this._resized) {
|
|
860
|
+
this._shouldUpdateLeftRight = false;
|
|
861
|
+
this._resized = false;
|
|
862
|
+
}
|
|
849
863
|
var eventColumnProps = this.columns;
|
|
850
864
|
this.forceUpdate();
|
|
851
865
|
if (this.props.onColumnReorder) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// offsetWidth() is slowly transition to reporting double instead of integet in all browsers
|
|
2
2
|
// during this process (which is a bit back-and-forth) we need to make sure we are working across all browsers and versions
|
|
3
3
|
var OFFSET_ROUND = 1;
|
|
4
|
+
var LOCK_COLUMN_BUFFER = 20;
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
7
8
|
var ColumnResize = /** @class */ (function () {
|
|
8
9
|
function ColumnResize(triggerResize) {
|
|
9
10
|
var _this = this;
|
|
10
|
-
// Typings. `col` and `colgroup` do not differ, both
|
|
11
|
+
// Typings. `col` and `colgroup` do not differ, both represent a `HTMLTableColElement`.
|
|
11
12
|
// Implemented as `any`.
|
|
12
13
|
this.columns = [];
|
|
13
14
|
/**
|
|
@@ -25,11 +26,11 @@ var ColumnResize = /** @class */ (function () {
|
|
|
25
26
|
e.stopPropagation();
|
|
26
27
|
e.stopImmediatePropagation();
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
-
if (!
|
|
29
|
+
var thElement = dragCue.closest('th');
|
|
30
|
+
if (!thElement || !thElement) {
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
var oldWidth =
|
|
33
|
+
var oldWidth = thElement.clientWidth;
|
|
33
34
|
var newWidth = oldWidth;
|
|
34
35
|
if (_this.isRtl) {
|
|
35
36
|
newWidth += (dragCue.getBoundingClientRect().right - (dragCue.offsetWidth / 2)) - event.clientX;
|
|
@@ -40,7 +41,7 @@ var ColumnResize = /** @class */ (function () {
|
|
|
40
41
|
if (!end && Math.abs(newWidth - oldWidth) < 1) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
_this.fixateInitialWidths(
|
|
44
|
+
_this.fixateInitialWidths(thElement.parentElement.clientWidth);
|
|
44
45
|
_this.setWidths(column, Math.floor(newWidth) / oldWidth);
|
|
45
46
|
var index = _this.columns.filter(function (c) { return !c.children.length; }).findIndex(function (c) { return c.id === column.id; });
|
|
46
47
|
_this.onResize(index, oldWidth, newWidth, e, end, column.id);
|
|
@@ -114,15 +115,21 @@ var ColumnResize = /** @class */ (function () {
|
|
|
114
115
|
var currentWidth = currentColumnFloorWidth + Math.floor(difference);
|
|
115
116
|
difference -= Math.floor(difference);
|
|
116
117
|
if (_this.colGroupMain && _this.colGroupMain.children[colIndex]) {
|
|
118
|
+
var mainWidth = parseInt(_this.colGroupMain.children[colIndex].width, 10);
|
|
117
119
|
_this.colGroupMain.children[colIndex].width = currentWidth + 'px';
|
|
120
|
+
_this.updateNextLockedCol(_this.colGroupMain.parentElement, currentColumn, mainWidth - currentWidth);
|
|
118
121
|
}
|
|
119
122
|
if (_this.colGroupHeader && _this.colGroupHeader.children[colIndex]) {
|
|
123
|
+
var headerWidth = parseInt(_this.colGroupHeader.children[colIndex].width, 10);
|
|
120
124
|
// static headers
|
|
121
125
|
_this.colGroupHeader.children[colIndex].width = currentWidth + 'px';
|
|
126
|
+
_this.updateNextLockedCol(_this.colGroupHeader.parentElement, currentColumn, headerWidth - currentWidth);
|
|
122
127
|
}
|
|
123
128
|
if (_this.colGroupFooter && _this.colGroupFooter.children[colIndex]) {
|
|
129
|
+
var footerWidth = parseInt(_this.colGroupFooter.children[colIndex].width, 10);
|
|
124
130
|
// static footers
|
|
125
131
|
_this.colGroupFooter.children[colIndex].width = currentWidth + 'px';
|
|
132
|
+
_this.updateNextLockedCol(_this.colGroupFooter.parentElement, currentColumn, footerWidth - currentWidth);
|
|
126
133
|
}
|
|
127
134
|
};
|
|
128
135
|
for (var i = 0; i < affectedColumns.length; i++) {
|
|
@@ -188,6 +195,40 @@ var ColumnResize = /** @class */ (function () {
|
|
|
188
195
|
this.updateColElements(toAdjust);
|
|
189
196
|
return toAdjust;
|
|
190
197
|
};
|
|
198
|
+
ColumnResize.prototype.updateNextLockedCol = function (element, current, deltaWidth) {
|
|
199
|
+
var _this = this;
|
|
200
|
+
var currentIndex = current.index;
|
|
201
|
+
var gridWrapperEl = this.colGroupMain.parentElement.closest('.k-grid');
|
|
202
|
+
var maxWidth = gridWrapperEl === null || gridWrapperEl === void 0 ? void 0 : gridWrapperEl.clientWidth;
|
|
203
|
+
var widthOfLocked = this.columns.filter(function (c) { return c.locked; }).map(function (e) { return parseInt(e.width + '', 10); }).reduce(function (a, b) { return a + b; }, 0);
|
|
204
|
+
if (!current.locked || maxWidth <= widthOfLocked + LOCK_COLUMN_BUFFER) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this.columns.forEach(function (nColumn) {
|
|
208
|
+
if ((nColumn === null || nColumn === void 0 ? void 0 : nColumn.locked) && deltaWidth) {
|
|
209
|
+
var allColumnEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('[aria-colindex="' + nColumn.ariaColumnIndex + '"]');
|
|
210
|
+
allColumnEls === null || allColumnEls === void 0 ? void 0 : allColumnEls.forEach(function (el) {
|
|
211
|
+
var currentStyle = el.style;
|
|
212
|
+
if (_this.isRtl) {
|
|
213
|
+
if (nColumn.index > currentIndex && currentStyle && currentStyle.right) {
|
|
214
|
+
currentStyle.right = parseInt(currentStyle.right, 10) - deltaWidth + 'px';
|
|
215
|
+
}
|
|
216
|
+
if (nColumn.index < currentIndex && currentStyle && currentStyle.left) {
|
|
217
|
+
currentStyle.left = parseInt(currentStyle.left, 10) - deltaWidth + 'px';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
if (nColumn.index > currentIndex && currentStyle && currentStyle.left) {
|
|
222
|
+
currentStyle.left = parseInt(currentStyle.left, 10) - deltaWidth + 'px';
|
|
223
|
+
}
|
|
224
|
+
if (nColumn.index < currentIndex && currentStyle && currentStyle.right) {
|
|
225
|
+
currentStyle.right = parseInt(currentStyle.right, 10) - deltaWidth + 'px';
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
};
|
|
191
232
|
return ColumnResize;
|
|
192
233
|
}());
|
|
193
234
|
export { ColumnResize };
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-grid',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1692018616,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
package/dist/es/utils/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ import { GridCellsSettings } from '../interfaces/GridCellsSettings';
|
|
|
32
32
|
/**
|
|
33
33
|
* @hidden
|
|
34
34
|
*/
|
|
35
|
-
export declare function readColumns(elements: (React.ReactNode | React.ReactChild | GridColumnProps)[], oldColumns:
|
|
35
|
+
export declare function readColumns(elements: (React.ReactNode | React.ReactChild | GridColumnProps)[], oldColumns: ExtendedColumnProps[], idInfo: {
|
|
36
36
|
prevId: number;
|
|
37
37
|
idPrefix: string;
|
|
38
38
|
}, depth?: number): ExtendedColumnProps[];
|
|
@@ -47,6 +47,10 @@ export declare function autoGenerateColumns(data: any[] | DataResult | null | un
|
|
|
47
47
|
* @hidden
|
|
48
48
|
*/
|
|
49
49
|
export declare const footerColumns: (columns: ExtendedColumnProps[]) => ExtendedColumnProps[];
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
export declare const getColumnWidth: (column: ExtendedColumnProps) => string | undefined;
|
|
50
54
|
/**
|
|
51
55
|
* @hidden
|
|
52
56
|
*/
|
package/dist/es/utils/index.js
CHANGED
|
@@ -130,7 +130,9 @@ export function readColumns(elements, oldColumns, idInfo, depth) {
|
|
|
130
130
|
children: children,
|
|
131
131
|
rowSpan: 0,
|
|
132
132
|
colSpan: 0,
|
|
133
|
-
isAccessible: true
|
|
133
|
+
isAccessible: true,
|
|
134
|
+
left: oldColumn && Math.floor(oldColumn.left),
|
|
135
|
+
right: oldColumn && Math.floor(oldColumn.right)
|
|
134
136
|
}));
|
|
135
137
|
});
|
|
136
138
|
var comparator = function (a, b) {
|
|
@@ -215,6 +217,14 @@ export var footerColumns = function (columns) {
|
|
|
215
217
|
return Boolean(column.footerCell) || !(column.children && column.children.length > 0);
|
|
216
218
|
});
|
|
217
219
|
};
|
|
220
|
+
/**
|
|
221
|
+
* @hidden
|
|
222
|
+
*/
|
|
223
|
+
export var getColumnWidth = function (column) {
|
|
224
|
+
return column.width !== undefined
|
|
225
|
+
? Math.floor(parseFloat(column.width.toString())) + 'px'
|
|
226
|
+
: undefined;
|
|
227
|
+
};
|
|
218
228
|
/**
|
|
219
229
|
* @hidden
|
|
220
230
|
*/
|
package/dist/npm/Grid.d.ts
CHANGED
|
@@ -109,6 +109,8 @@ export declare class Grid extends React.Component<GridProps> {
|
|
|
109
109
|
private _columns;
|
|
110
110
|
private _columnsMap;
|
|
111
111
|
private _columnsMutations;
|
|
112
|
+
private _resized;
|
|
113
|
+
private _shouldUpdateLeftRight;
|
|
112
114
|
private contextStateRef;
|
|
113
115
|
private navigationStateRef;
|
|
114
116
|
private _data;
|
package/dist/npm/Grid.js
CHANGED
|
@@ -104,6 +104,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
104
104
|
_this._columns = [];
|
|
105
105
|
_this._columnsMap = [[]];
|
|
106
106
|
_this._columnsMutations = 0;
|
|
107
|
+
_this._resized = false;
|
|
108
|
+
_this._shouldUpdateLeftRight = true;
|
|
107
109
|
_this.contextStateRef = { current: undefined };
|
|
108
110
|
_this.navigationStateRef = { current: undefined };
|
|
109
111
|
_this._data = [];
|
|
@@ -360,6 +362,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
360
362
|
};
|
|
361
363
|
_this.onResize = function (index, newWidth, oldWidth, nativeEvent, end, targetId) {
|
|
362
364
|
_this.resetTableWidth();
|
|
365
|
+
_this._shouldUpdateLeftRight = true;
|
|
366
|
+
_this._resized = true;
|
|
363
367
|
_this._columnsMutations++;
|
|
364
368
|
if (_this.props.onColumnResize) {
|
|
365
369
|
_this.props.onColumnResize.call(undefined, {
|
|
@@ -435,8 +439,8 @@ var Grid = /** @class */ (function (_super) {
|
|
|
435
439
|
}
|
|
436
440
|
columns.slice(columnIndexOffset).forEach(function (c) { return c.parentIndex >= 0 && (c.parentIndex += columnIndexOffset); });
|
|
437
441
|
});
|
|
438
|
-
_this.getHeaderRow = (0, kendo_react_common_1.memoizeOne)(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap) {
|
|
439
|
-
return (React.createElement(HeaderRow_1.HeaderRow, { cells: _this.props.cells, sort: sort, sortable: sortable, sortChange: _this.sortChange, group: group || [], groupable: groupable, groupChange: _this.groupChange, filter: filter, filterable: filterable, filterOperators: filterOperators, filterChange: _this.filterChange, columnMenu: columnMenu, selectionChange: _this.onHeaderSelectionChange, columns: columns, columnResize: _this.columnResize, pressHandler: _this.dragLogic.pressHandler, dragHandler: _this.dragLogic.dragHandler, releaseHandler: _this.dragLogic.releaseHandler, columnsMap: columnsMap, cellRender: headerCellRender, isRtl:
|
|
442
|
+
_this.getHeaderRow = (0, kendo_react_common_1.memoizeOne)(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap, isHeaderRtl) {
|
|
443
|
+
return (React.createElement(HeaderRow_1.HeaderRow, { cells: _this.props.cells, sort: sort, sortable: sortable, sortChange: _this.sortChange, group: group || [], groupable: groupable, groupChange: _this.groupChange, filter: filter, filterable: filterable, filterOperators: filterOperators, filterChange: _this.filterChange, columnMenu: columnMenu, selectionChange: _this.onHeaderSelectionChange, columns: columns, columnResize: _this.columnResize, pressHandler: _this.dragLogic.pressHandler, dragHandler: _this.dragLogic.dragHandler, releaseHandler: _this.dragLogic.releaseHandler, columnsMap: columnsMap, cellRender: headerCellRender, isRtl: isHeaderRtl, dragClue: _this.dragLogic.dragClueRef, headerRef: _this.headerElementRef, containerRef: _this.containerRef }));
|
|
440
444
|
});
|
|
441
445
|
_this.resolveTitle = function (field) {
|
|
442
446
|
var column = _this._columns.find(function (c) { return c.field === field; });
|
|
@@ -600,6 +604,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
600
604
|
Grid.prototype.render = function () {
|
|
601
605
|
var _a, _b, _c, _d;
|
|
602
606
|
var _this = this;
|
|
607
|
+
var _e;
|
|
603
608
|
var total = this.props.total || 0;
|
|
604
609
|
var idPrefix = kendo_react_data_tools_1.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef);
|
|
605
610
|
var propsData = [];
|
|
@@ -612,7 +617,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
612
617
|
total = total || this.props.data.total;
|
|
613
618
|
}
|
|
614
619
|
var groupingFooter = (typeof this.props.groupable === 'object') && this.props.groupable.footer || 'none';
|
|
615
|
-
var
|
|
620
|
+
var _f = this.flatData(propsData, groupingFooter, this.props.skip || 0, this.props.group, this.props.expandField, this.props.filter, this.props.sort), resolvedGroupsCount = _f.resolvedGroupsCount, flattedData = _f.flattedData;
|
|
616
621
|
this._data = flattedData;
|
|
617
622
|
var groupable = this.props.groupable === true ||
|
|
618
623
|
(typeof this.props.groupable === 'object') && this.props.groupable.enabled !== false;
|
|
@@ -629,17 +634,16 @@ var Grid = /** @class */ (function (_super) {
|
|
|
629
634
|
child.type.displayName === 'KendoReactGridNoRecords'; });
|
|
630
635
|
var leafColumns = this._columns.filter(function (c) { return c.children.length === 0; });
|
|
631
636
|
var groupingPanel = groupable && (React.createElement(GroupPanel_1.GroupPanel, { group: this.props.group || [], groupChange: this.groupChange, pressHandler: this.dragLogic.pressHandler, dragHandler: this.dragLogic.dragHandler, releaseHandler: this.dragLogic.releaseHandler, refCallback: this.dragLogic.refGroupPanelDiv, resolveTitle: this.resolveTitle }));
|
|
632
|
-
var
|
|
633
|
-
var header = (React.createElement(Header_1.Header, { size: this.props.size, columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', scrollableDataElement: function () { return _this.vs.container; }, draggable: this.props.reorderable || groupable, ref: this.headerRef, elemRef: this.headerElementRef, headerRow: this.getHeaderRow(sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, this._columns, this._columnsMap), filterRow: this.props.filterable && React.createElement(FilterRow_1.FilterRow, { cells: this.props.cells, size: this.props.size, columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || filterCommon_1.operators, filterChange: this.filterChange, sort: this.props.sort, cellRender: this.props.filterCellRender, isRtl: this.isRtl, ariaRowIndex: this._columnsMap.length + 1 }) || undefined, cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: column
|
|
634
|
-
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); }) }));
|
|
637
|
+
var _g = this.props, sort = _g.sort, sortable = _g.sortable, group = _g.group, filter = _g.filter, filterable = _g.filterable, _h = _g.filterOperators, filterOperators = _h === void 0 ? filterCommon_1.operators : _h, headerCellRender = _g.headerCellRender, columnMenu = _g.columnMenu;
|
|
638
|
+
var header = (React.createElement(Header_1.Header, { size: this.props.size, columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', scrollableDataElement: function () { return _this.vs.container; }, draggable: this.props.reorderable || groupable, ref: this.headerRef, elemRef: this.headerElementRef, headerRow: this.getHeaderRow(sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, this._columns, this._columnsMap, this.isRtl), filterRow: this.props.filterable && React.createElement(FilterRow_1.FilterRow, { cells: this.props.cells, size: this.props.size, columns: this._columns, filter: this.props.filter, filterOperators: this.props.filterOperators || filterCommon_1.operators, filterChange: this.filterChange, sort: this.props.sort, cellRender: this.props.filterCellRender, isRtl: this.isRtl, ariaRowIndex: this._columnsMap.length + 1 }) || undefined, cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: (0, index_1.getColumnWidth)(column) })); }) }));
|
|
635
639
|
var scrollLeft = this.vs && this.vs.container && this.vs.container.scrollLeft || 0;
|
|
636
640
|
var tableWidth = parseFloat(((this.props.style || {}).width || '').toString());
|
|
637
|
-
var
|
|
641
|
+
var _j = (0, kendo_react_data_tools_1.tableColumnsVirtualization)({
|
|
638
642
|
enabled: this.props.columnVirtualization,
|
|
639
643
|
columns: leafColumns,
|
|
640
644
|
tableViewPortWidth: tableWidth,
|
|
641
645
|
scrollLeft: scrollLeft
|
|
642
|
-
}), colSpans =
|
|
646
|
+
}), colSpans = _j.colSpans, isColHidden = _j.hiddenColumns;
|
|
643
647
|
var dataRow = function (item, rowId, rowDataIndex) {
|
|
644
648
|
var isInEdit = false;
|
|
645
649
|
var selectedValue = _this.props.selectedField ? (0, index_1.getNestedValue)(_this.props.selectedField, item.dataItem) : undefined;
|
|
@@ -744,12 +748,15 @@ var Grid = /** @class */ (function (_super) {
|
|
|
744
748
|
var sorted = function (field) {
|
|
745
749
|
return _this.props.sort && _this.props.sort.filter(function (descriptor) { return descriptor.field === field; }).length > 0;
|
|
746
750
|
};
|
|
747
|
-
var
|
|
748
|
-
|
|
751
|
+
var footerCols = function (column, index) {
|
|
752
|
+
return (React.createElement("col", { key: index.toString(), width: (0, index_1.getColumnWidth)(column) }));
|
|
753
|
+
};
|
|
754
|
+
var footer = (Boolean((_e = this.props.cells) === null || _e === void 0 ? void 0 : _e.footerCell)
|
|
755
|
+
|| this._columns.some(function (c) { var _a; return Boolean(c.footerCell || Boolean((_a = c.cells) === null || _a === void 0 ? void 0 : _a.footerCell)); }))
|
|
756
|
+
? (React.createElement(Footer_1.Footer, { size: this.props.size, columnResize: this.columnResize, staticHeaders: this.props.scrollable !== 'none', ref: function (f) { return _this._footer = f; }, row: React.createElement(FooterRow_1.FooterRow, { cells: this.props.cells, columns: this._columns, isRtl: this.isRtl, ariaRowIndex: currentAriaRowIndex + 1 }), cols: leafColumns.map(footerCols) })) : null;
|
|
749
757
|
var colGroups = (React.createElement("colgroup", { ref: function (c) {
|
|
750
758
|
_this.columnResize.colGroupMain = c;
|
|
751
|
-
} }, leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), className: sorted(column.field) ? 'k-sorted' : undefined, width: column
|
|
752
|
-
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); })));
|
|
759
|
+
} }, leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), className: sorted(column.field) ? 'k-sorted' : undefined, width: (0, index_1.getColumnWidth)(column) })); })));
|
|
753
760
|
var enableDragClues = this.dragLogic.reorderable || this.dragLogic.groupable;
|
|
754
761
|
var tableDisplay = this.props.columnVirtualization ? 'block' : 'table';
|
|
755
762
|
if (this.props.scrollable === 'none') {
|
|
@@ -849,6 +856,13 @@ var Grid = /** @class */ (function (_super) {
|
|
|
849
856
|
(_a = this._columns).splice.apply(_a, __spreadArray([prev < next ? end(next - spliced.length) : next, 0], spliced, false));
|
|
850
857
|
this._columns.filter(function (q) { return q.declarationIndex >= 0; }).forEach(function (c, i) { return c.orderIndex = i; });
|
|
851
858
|
this._columnsMutations++;
|
|
859
|
+
var shouldUpdateRL = this._columns[prev].locked && this._columns[next].locked;
|
|
860
|
+
(0, kendo_react_data_tools_1.updateLeft)(this._columnsMap, this._columns, shouldUpdateRL || this._shouldUpdateLeftRight);
|
|
861
|
+
(0, kendo_react_data_tools_1.updateRight)(this._columnsMap, this._columns, shouldUpdateRL || this._shouldUpdateLeftRight);
|
|
862
|
+
if (this._resized) {
|
|
863
|
+
this._shouldUpdateLeftRight = false;
|
|
864
|
+
this._resized = false;
|
|
865
|
+
}
|
|
852
866
|
var eventColumnProps = this.columns;
|
|
853
867
|
this.forceUpdate();
|
|
854
868
|
if (this.props.onColumnReorder) {
|
|
@@ -4,13 +4,14 @@ exports.ColumnResize = void 0;
|
|
|
4
4
|
// offsetWidth() is slowly transition to reporting double instead of integet in all browsers
|
|
5
5
|
// during this process (which is a bit back-and-forth) we need to make sure we are working across all browsers and versions
|
|
6
6
|
var OFFSET_ROUND = 1;
|
|
7
|
+
var LOCK_COLUMN_BUFFER = 20;
|
|
7
8
|
/**
|
|
8
9
|
* @hidden
|
|
9
10
|
*/
|
|
10
11
|
var ColumnResize = /** @class */ (function () {
|
|
11
12
|
function ColumnResize(triggerResize) {
|
|
12
13
|
var _this = this;
|
|
13
|
-
// Typings. `col` and `colgroup` do not differ, both
|
|
14
|
+
// Typings. `col` and `colgroup` do not differ, both represent a `HTMLTableColElement`.
|
|
14
15
|
// Implemented as `any`.
|
|
15
16
|
this.columns = [];
|
|
16
17
|
/**
|
|
@@ -28,11 +29,11 @@ var ColumnResize = /** @class */ (function () {
|
|
|
28
29
|
e.stopPropagation();
|
|
29
30
|
e.stopImmediatePropagation();
|
|
30
31
|
}
|
|
31
|
-
var
|
|
32
|
-
if (!
|
|
32
|
+
var thElement = dragCue.closest('th');
|
|
33
|
+
if (!thElement || !thElement) {
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
var oldWidth =
|
|
36
|
+
var oldWidth = thElement.clientWidth;
|
|
36
37
|
var newWidth = oldWidth;
|
|
37
38
|
if (_this.isRtl) {
|
|
38
39
|
newWidth += (dragCue.getBoundingClientRect().right - (dragCue.offsetWidth / 2)) - event.clientX;
|
|
@@ -43,7 +44,7 @@ var ColumnResize = /** @class */ (function () {
|
|
|
43
44
|
if (!end && Math.abs(newWidth - oldWidth) < 1) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
_this.fixateInitialWidths(
|
|
47
|
+
_this.fixateInitialWidths(thElement.parentElement.clientWidth);
|
|
47
48
|
_this.setWidths(column, Math.floor(newWidth) / oldWidth);
|
|
48
49
|
var index = _this.columns.filter(function (c) { return !c.children.length; }).findIndex(function (c) { return c.id === column.id; });
|
|
49
50
|
_this.onResize(index, oldWidth, newWidth, e, end, column.id);
|
|
@@ -117,15 +118,21 @@ var ColumnResize = /** @class */ (function () {
|
|
|
117
118
|
var currentWidth = currentColumnFloorWidth + Math.floor(difference);
|
|
118
119
|
difference -= Math.floor(difference);
|
|
119
120
|
if (_this.colGroupMain && _this.colGroupMain.children[colIndex]) {
|
|
121
|
+
var mainWidth = parseInt(_this.colGroupMain.children[colIndex].width, 10);
|
|
120
122
|
_this.colGroupMain.children[colIndex].width = currentWidth + 'px';
|
|
123
|
+
_this.updateNextLockedCol(_this.colGroupMain.parentElement, currentColumn, mainWidth - currentWidth);
|
|
121
124
|
}
|
|
122
125
|
if (_this.colGroupHeader && _this.colGroupHeader.children[colIndex]) {
|
|
126
|
+
var headerWidth = parseInt(_this.colGroupHeader.children[colIndex].width, 10);
|
|
123
127
|
// static headers
|
|
124
128
|
_this.colGroupHeader.children[colIndex].width = currentWidth + 'px';
|
|
129
|
+
_this.updateNextLockedCol(_this.colGroupHeader.parentElement, currentColumn, headerWidth - currentWidth);
|
|
125
130
|
}
|
|
126
131
|
if (_this.colGroupFooter && _this.colGroupFooter.children[colIndex]) {
|
|
132
|
+
var footerWidth = parseInt(_this.colGroupFooter.children[colIndex].width, 10);
|
|
127
133
|
// static footers
|
|
128
134
|
_this.colGroupFooter.children[colIndex].width = currentWidth + 'px';
|
|
135
|
+
_this.updateNextLockedCol(_this.colGroupFooter.parentElement, currentColumn, footerWidth - currentWidth);
|
|
129
136
|
}
|
|
130
137
|
};
|
|
131
138
|
for (var i = 0; i < affectedColumns.length; i++) {
|
|
@@ -191,6 +198,40 @@ var ColumnResize = /** @class */ (function () {
|
|
|
191
198
|
this.updateColElements(toAdjust);
|
|
192
199
|
return toAdjust;
|
|
193
200
|
};
|
|
201
|
+
ColumnResize.prototype.updateNextLockedCol = function (element, current, deltaWidth) {
|
|
202
|
+
var _this = this;
|
|
203
|
+
var currentIndex = current.index;
|
|
204
|
+
var gridWrapperEl = this.colGroupMain.parentElement.closest('.k-grid');
|
|
205
|
+
var maxWidth = gridWrapperEl === null || gridWrapperEl === void 0 ? void 0 : gridWrapperEl.clientWidth;
|
|
206
|
+
var widthOfLocked = this.columns.filter(function (c) { return c.locked; }).map(function (e) { return parseInt(e.width + '', 10); }).reduce(function (a, b) { return a + b; }, 0);
|
|
207
|
+
if (!current.locked || maxWidth <= widthOfLocked + LOCK_COLUMN_BUFFER) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this.columns.forEach(function (nColumn) {
|
|
211
|
+
if ((nColumn === null || nColumn === void 0 ? void 0 : nColumn.locked) && deltaWidth) {
|
|
212
|
+
var allColumnEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('[aria-colindex="' + nColumn.ariaColumnIndex + '"]');
|
|
213
|
+
allColumnEls === null || allColumnEls === void 0 ? void 0 : allColumnEls.forEach(function (el) {
|
|
214
|
+
var currentStyle = el.style;
|
|
215
|
+
if (_this.isRtl) {
|
|
216
|
+
if (nColumn.index > currentIndex && currentStyle && currentStyle.right) {
|
|
217
|
+
currentStyle.right = parseInt(currentStyle.right, 10) - deltaWidth + 'px';
|
|
218
|
+
}
|
|
219
|
+
if (nColumn.index < currentIndex && currentStyle && currentStyle.left) {
|
|
220
|
+
currentStyle.left = parseInt(currentStyle.left, 10) - deltaWidth + 'px';
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
if (nColumn.index > currentIndex && currentStyle && currentStyle.left) {
|
|
225
|
+
currentStyle.left = parseInt(currentStyle.left, 10) - deltaWidth + 'px';
|
|
226
|
+
}
|
|
227
|
+
if (nColumn.index < currentIndex && currentStyle && currentStyle.right) {
|
|
228
|
+
currentStyle.right = parseInt(currentStyle.right, 10) - deltaWidth + 'px';
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
};
|
|
194
235
|
return ColumnResize;
|
|
195
236
|
}());
|
|
196
237
|
exports.ColumnResize = ColumnResize;
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-grid',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1692018616,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
};
|
|
@@ -32,7 +32,7 @@ import { GridCellsSettings } from '../interfaces/GridCellsSettings';
|
|
|
32
32
|
/**
|
|
33
33
|
* @hidden
|
|
34
34
|
*/
|
|
35
|
-
export declare function readColumns(elements: (React.ReactNode | React.ReactChild | GridColumnProps)[], oldColumns:
|
|
35
|
+
export declare function readColumns(elements: (React.ReactNode | React.ReactChild | GridColumnProps)[], oldColumns: ExtendedColumnProps[], idInfo: {
|
|
36
36
|
prevId: number;
|
|
37
37
|
idPrefix: string;
|
|
38
38
|
}, depth?: number): ExtendedColumnProps[];
|
|
@@ -47,6 +47,10 @@ export declare function autoGenerateColumns(data: any[] | DataResult | null | un
|
|
|
47
47
|
* @hidden
|
|
48
48
|
*/
|
|
49
49
|
export declare const footerColumns: (columns: ExtendedColumnProps[]) => ExtendedColumnProps[];
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
export declare const getColumnWidth: (column: ExtendedColumnProps) => string | undefined;
|
|
50
54
|
/**
|
|
51
55
|
* @hidden
|
|
52
56
|
*/
|
package/dist/npm/utils/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.resolveCells = exports.firefoxMaxHeight = exports.firefox = exports.sanitizeColumns = exports.footerColumns = exports.autoGenerateColumns = exports.readColumns = exports.checkPropCompatibility = exports.flatData = exports.getNestedValue = void 0;
|
|
25
|
+
exports.resolveCells = exports.firefoxMaxHeight = exports.firefox = exports.sanitizeColumns = exports.getColumnWidth = exports.footerColumns = exports.autoGenerateColumns = exports.readColumns = exports.checkPropCompatibility = exports.flatData = exports.getNestedValue = void 0;
|
|
26
26
|
/**
|
|
27
27
|
* @hidden
|
|
28
28
|
*/
|
|
@@ -136,7 +136,9 @@ function readColumns(elements, oldColumns, idInfo, depth) {
|
|
|
136
136
|
children: children,
|
|
137
137
|
rowSpan: 0,
|
|
138
138
|
colSpan: 0,
|
|
139
|
-
isAccessible: true
|
|
139
|
+
isAccessible: true,
|
|
140
|
+
left: oldColumn && Math.floor(oldColumn.left),
|
|
141
|
+
right: oldColumn && Math.floor(oldColumn.right)
|
|
140
142
|
}));
|
|
141
143
|
});
|
|
142
144
|
var comparator = function (a, b) {
|
|
@@ -224,6 +226,15 @@ var footerColumns = function (columns) {
|
|
|
224
226
|
});
|
|
225
227
|
};
|
|
226
228
|
exports.footerColumns = footerColumns;
|
|
229
|
+
/**
|
|
230
|
+
* @hidden
|
|
231
|
+
*/
|
|
232
|
+
var getColumnWidth = function (column) {
|
|
233
|
+
return column.width !== undefined
|
|
234
|
+
? Math.floor(parseFloat(column.width.toString())) + 'px'
|
|
235
|
+
: undefined;
|
|
236
|
+
};
|
|
237
|
+
exports.getColumnWidth = getColumnWidth;
|
|
227
238
|
/**
|
|
228
239
|
* @hidden
|
|
229
240
|
*/
|