@progress/kendo-react-grid 5.14.0-dev.202305291502 → 5.14.0-dev.202305301859
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.js +6 -6
- package/dist/es/cells/GridCell.d.ts +2 -2
- package/dist/es/cells/GridCell.js +16 -4
- package/dist/es/cells/GridEditCell.d.ts +2 -2
- package/dist/es/cells/GridEditCell.js +23 -9
- package/dist/es/cells/GridGroupCell.d.ts +2 -2
- package/dist/es/cells/GridGroupCell.js +50 -24
- package/dist/es/cells/GridHierarchyCell.d.ts +2 -2
- package/dist/es/cells/GridHierarchyCell.js +25 -15
- package/dist/es/cells/GridSelectionCell.js +13 -3
- package/dist/es/footer/FooterRow.d.ts +2 -0
- package/dist/es/footer/FooterRow.js +22 -11
- package/dist/es/header/FilterRow.d.ts +2 -0
- package/dist/es/header/FilterRow.js +10 -2
- package/dist/es/header/HeaderRow.d.ts +2 -0
- package/dist/es/header/HeaderRow.js +14 -5
- package/dist/es/interfaces/GridCellProps.d.ts +5 -0
- package/dist/es/interfaces/GridCellsSettings.d.ts +111 -0
- package/dist/es/interfaces/GridCellsSettings.js +1 -0
- package/dist/es/interfaces/GridColumnProps.d.ts +5 -0
- package/dist/es/interfaces/GridProps.d.ts +5 -0
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/index.d.ts +5 -0
- package/dist/es/utils/index.js +15 -0
- package/dist/npm/Grid.js +5 -5
- package/dist/npm/cells/GridCell.d.ts +2 -2
- package/dist/npm/cells/GridCell.js +16 -4
- package/dist/npm/cells/GridEditCell.d.ts +2 -2
- package/dist/npm/cells/GridEditCell.js +23 -9
- package/dist/npm/cells/GridGroupCell.d.ts +2 -2
- package/dist/npm/cells/GridGroupCell.js +50 -24
- package/dist/npm/cells/GridHierarchyCell.d.ts +2 -2
- package/dist/npm/cells/GridHierarchyCell.js +25 -15
- package/dist/npm/cells/GridSelectionCell.js +13 -3
- package/dist/npm/footer/FooterRow.d.ts +2 -0
- package/dist/npm/footer/FooterRow.js +21 -10
- package/dist/npm/header/FilterRow.d.ts +2 -0
- package/dist/npm/header/FilterRow.js +10 -2
- package/dist/npm/header/HeaderRow.d.ts +2 -0
- package/dist/npm/header/HeaderRow.js +14 -5
- package/dist/npm/interfaces/GridCellProps.d.ts +5 -0
- package/dist/npm/interfaces/GridCellsSettings.d.ts +111 -0
- package/dist/npm/interfaces/GridCellsSettings.js +3 -0
- package/dist/npm/interfaces/GridColumnProps.d.ts +5 -0
- package/dist/npm/interfaces/GridProps.d.ts +5 -0
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +1 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/index.d.ts +5 -0
- package/dist/npm/utils/index.js +17 -1
- package/dist/systemjs/kendo-react-grid.js +1 -1
- package/package.json +18 -18
package/dist/es/Grid.js
CHANGED
|
@@ -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 } from './utils/index';
|
|
52
|
+
import { getNestedValue, flatData, readColumns, autoGenerateColumns, firefox, firefoxMaxHeight, sanitizeColumns, resolveCells } from './utils/index';
|
|
53
53
|
import { GridCell } from './cells/GridCell';
|
|
54
54
|
import { GridGroupCell } from './cells/GridGroupCell';
|
|
55
55
|
import { GridRow } from './rows/GridRow';
|
|
@@ -432,7 +432,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
432
432
|
columns.slice(columnIndexOffset).forEach(function (c) { return c.parentIndex >= 0 && (c.parentIndex += columnIndexOffset); });
|
|
433
433
|
});
|
|
434
434
|
_this.getHeaderRow = memoizeOne(function (sort, sortable, group, groupable, filter, filterable, filterOperators, headerCellRender, columnMenu, columns, columnsMap) {
|
|
435
|
-
return (React.createElement(HeaderRow, { 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: _this.isRtl, dragClue: _this.dragLogic.dragClueRef, headerRef: _this.headerElementRef, containerRef: _this.containerRef }));
|
|
435
|
+
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: _this.isRtl, dragClue: _this.dragLogic.dragClueRef, headerRef: _this.headerElementRef, containerRef: _this.containerRef }));
|
|
436
436
|
});
|
|
437
437
|
_this.resolveTitle = function (field) {
|
|
438
438
|
var column = _this._columns.find(function (c) { return c.field === field; });
|
|
@@ -624,7 +624,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
624
624
|
var leafColumns = this._columns.filter(function (c) { return c.children.length === 0; });
|
|
625
625
|
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 }));
|
|
626
626
|
var _e = this.props, sort = _e.sort, sortable = _e.sortable, group = _e.group, filter = _e.filter, filterable = _e.filterable, _f = _e.filterOperators, filterOperators = _f === void 0 ? operators : _f, headerCellRender = _e.headerCellRender, columnMenu = _e.columnMenu;
|
|
627
|
-
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, { 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.width !== undefined ?
|
|
627
|
+
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.width !== undefined ?
|
|
628
628
|
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); }) }));
|
|
629
629
|
var scrollLeft = this.vs && this.vs.container && this.vs.container.scrollLeft || 0;
|
|
630
630
|
var tableWidth = parseFloat(((this.props.style || {}).width || '').toString());
|
|
@@ -659,7 +659,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
var Cell = column.cell || (currentColumnIsInEdit && GridEditCell) || GridCell;
|
|
662
|
-
return (React.createElement(Cell, { onContextMenu: _this.onContextMenu, key: columnKey, locked: _this.props.lockGroups, id: navigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
|
|
662
|
+
return (React.createElement(Cell, { onContextMenu: _this.onContextMenu, key: columnKey, locked: _this.props.lockGroups, id: navigationTools.generateNavigatableId("".concat(rowId, "-").concat(String(columnIndex)), idPrefix), colSpan: colSpans[columnIndex], dataItem: item.dataItem, field: column.field, editor: column.editor, format: column.format, className: className, render: _this.props.cellRender, cells: resolveCells(_this.props.cells, column.cells), onChange: _this.itemChange, selectionChange: (_this.props.onSelectionChange) ?
|
|
663
663
|
(function (e) { _this.selectionChange({ event: e, dataItem: item.dataItem, dataIndex: rowDataIndex, columnIndex: columnIndex }); }) :
|
|
664
664
|
undefined, columnIndex: columnIndex, columnsCount: leafColumns.length, rowType: item.rowType, level: item.level, expanded: item.expanded, dataIndex: item.dataIndex, style: style, ariaColumnIndex: column.ariaColumnIndex, isSelected: Array.isArray(selectedValue) && selectedValue.indexOf(columnIndex) > -1 }));
|
|
665
665
|
}),
|
|
@@ -721,7 +721,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
721
721
|
? { left: columnStyle.left, right: columnStyle.right }
|
|
722
722
|
: { left: columnStyle.right, right: columnStyle.left }
|
|
723
723
|
: {};
|
|
724
|
-
return (React.createElement(GridGroupCell, { id: '', dataIndex: item.dataIndex, field: gr.field, dataItem: item.dataItem, key: idx, style: style, ariaColumnIndex: 1 + idx, isSelected: false, locked: _this.props.lockGroups, isRtl: _this.isRtl }));
|
|
724
|
+
return (React.createElement(GridGroupCell, { id: '', dataIndex: item.dataIndex, field: gr.field, dataItem: item.dataItem, key: idx, style: style, ariaColumnIndex: 1 + idx, isSelected: false, locked: _this.props.lockGroups, isRtl: _this.isRtl, cells: _this.props.cells }));
|
|
725
725
|
}),
|
|
726
726
|
_this.props.expandField &&
|
|
727
727
|
React.createElement(GridDetailHierarchyCell, { id: navigationTools.generateNavigatableId("".concat(detailRowId, "-dhcell"), idPrefix) }),
|
|
@@ -738,7 +738,7 @@ var Grid = /** @class */ (function (_super) {
|
|
|
738
738
|
var sorted = function (field) {
|
|
739
739
|
return _this.props.sort && _this.props.sort.filter(function (descriptor) { return descriptor.field === field; }).length > 0;
|
|
740
740
|
};
|
|
741
|
-
var footer = this._columns.some(function (c) { return Boolean(c.footerCell); }) ? (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, { columns: this._columns, isRtl: this.isRtl, ariaRowIndex: currentAriaRowIndex + 1 }), cols: leafColumns.map(function (column, index) { return (React.createElement("col", { key: index.toString(), width: column.width !== undefined ?
|
|
741
|
+
var footer = this._columns.some(function (c) { return Boolean(c.footerCell); }) ? (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(function (column, index) { return (React.createElement("col", { key: index.toString(), width: column.width !== undefined ?
|
|
742
742
|
Math.floor(parseFloat(column.width.toString())) + 'px' : undefined })); }) })) : null;
|
|
743
743
|
var colGroups = (React.createElement("colgroup", { ref: function (c) {
|
|
744
744
|
_this.columnResize.colGroupMain = c;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { GridCellProps } from '../interfaces/GridCellProps';
|
|
3
|
-
export declare const GridCell: (props: GridCellProps) =>
|
|
3
|
+
export declare const GridCell: (props: GridCellProps) => JSX.Element | null;
|
|
@@ -25,19 +25,31 @@ export var GridCell = function (props) {
|
|
|
25
25
|
props.onContextMenu.call(undefined, event, props.dataItem, props.field);
|
|
26
26
|
}
|
|
27
27
|
}, [props.onContextMenu, props.dataItem, props.field]);
|
|
28
|
+
var tdProps = null;
|
|
29
|
+
var content = null;
|
|
28
30
|
if (props.rowType === 'groupFooter') {
|
|
29
|
-
|
|
31
|
+
tdProps = {
|
|
32
|
+
onContextMenu: onContextMenu,
|
|
33
|
+
className: props.className
|
|
34
|
+
};
|
|
35
|
+
defaultRendering = React.createElement("td", __assign({}, tdProps));
|
|
30
36
|
}
|
|
31
37
|
else if (props.field !== undefined && props.rowType !== 'groupHeader') {
|
|
32
38
|
var data = getNestedValue(props.field, props.dataItem);
|
|
33
|
-
var dataAsString = '';
|
|
34
39
|
if (data !== undefined && data !== null) {
|
|
35
|
-
|
|
40
|
+
content = props.format ?
|
|
36
41
|
intl.format(props.format, data) :
|
|
37
42
|
data.toString();
|
|
38
43
|
}
|
|
39
44
|
var className = classNames('k-table-td', props.className, { 'k-selected': props.isSelected });
|
|
40
|
-
|
|
45
|
+
tdProps = __assign((_a = { onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: className, role: 'gridcell', 'aria-colindex': props.ariaColumnIndex, 'aria-selected': props.isSelected }, _a[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _a), navigationAttributes);
|
|
46
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps), content));
|
|
47
|
+
}
|
|
48
|
+
var rowTypeSetting = props.rowType || 'data';
|
|
49
|
+
var customCells = props.cells;
|
|
50
|
+
if (customCells && customCells[rowTypeSetting]) {
|
|
51
|
+
var CustomCell = customCells[rowTypeSetting];
|
|
52
|
+
return (React.createElement(CustomCell, __assign({}, props, { tdProps: tdProps }), content));
|
|
41
53
|
}
|
|
42
54
|
return props.render ?
|
|
43
55
|
props.render.call(undefined, defaultRendering, props) :
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { GridCellProps } from '../interfaces/GridCellProps';
|
|
3
3
|
/**
|
|
4
4
|
* @hidden
|
|
5
5
|
*/
|
|
6
|
-
export declare const GridEditCell: (props: GridCellProps) =>
|
|
6
|
+
export declare const GridEditCell: (props: GridCellProps) => JSX.Element | null;
|
|
@@ -28,6 +28,8 @@ export var GridEditCell = function (props) {
|
|
|
28
28
|
_a), props.className);
|
|
29
29
|
var inputId = React.useMemo(function () { return guid(); }, []);
|
|
30
30
|
var navigationAttributes = useTableKeyboardNavigation(props.id);
|
|
31
|
+
var tdProps = null;
|
|
32
|
+
var content = null;
|
|
31
33
|
var handleOnChange = React.useCallback(function (syntheticEvent) {
|
|
32
34
|
if (props.onChange) {
|
|
33
35
|
var value = syntheticEvent.target.type === 'checkbox' ?
|
|
@@ -60,21 +62,33 @@ export var GridEditCell = function (props) {
|
|
|
60
62
|
}, [props.onChange, props.dataItem, props.dataIndex, props.field]);
|
|
61
63
|
switch (props.editor) {
|
|
62
64
|
case 'numeric':
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
tdProps = __assign((_b = { onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses }, _b['aria-colindex'] = props.ariaColumnIndex, _b['aria-selected'] = props.isSelected, _b[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _b.role = 'gridcell', _b), navigationAttributes);
|
|
66
|
+
content = (React.createElement(NumericTextBox, { width: "100%", value: (data === undefined) ? null : data, onChange: inputChange }));
|
|
67
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps), content));
|
|
65
68
|
break;
|
|
66
69
|
case 'date':
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
tdProps = __assign((_c = { onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses }, _c['aria-colindex'] = props.ariaColumnIndex, _c['aria-selected'] = props.isSelected, _c[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _c.role = 'gridcell', _c), navigationAttributes);
|
|
71
|
+
content = (React.createElement(DatePicker, { width: "100%", value: data, onChange: inputChange }));
|
|
72
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps), content));
|
|
69
73
|
break;
|
|
70
74
|
case 'boolean':
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
React.createElement("
|
|
75
|
+
tdProps = __assign((_d = { onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses }, _d['aria-colindex'] = props.ariaColumnIndex, _d['aria-selected'] = props.isSelected, _d[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _d.role = 'gridcell', _d), navigationAttributes);
|
|
76
|
+
content = ([
|
|
77
|
+
React.createElement("input", { checked: data || false, id: inputId, type: "checkbox", className: "k-checkbox k-checkbox-md k-rounded-md", onChange: handleOnChange, key: 1 }),
|
|
78
|
+
React.createElement("label", { className: "k-checkbox-label", htmlFor: inputId, key: 2 })
|
|
79
|
+
]);
|
|
80
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps), content));
|
|
74
81
|
break;
|
|
75
82
|
default:
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
tdProps = __assign((_e = { onContextMenu: onContextMenu, colSpan: props.colSpan, style: props.style, className: editCellClasses }, _e['aria-colindex'] = props.ariaColumnIndex, _e['aria-selected'] = props.isSelected, _e[GRID_COL_INDEX_ATTRIBUTE] = props.columnIndex, _e.role = 'gridcell', _e), navigationAttributes);
|
|
84
|
+
content = (React.createElement("input", { style: { width: '100%' }, className: "k-input", value: data || '', onChange: handleOnChange }));
|
|
85
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps), content));
|
|
86
|
+
}
|
|
87
|
+
var editorSetting = props.editor || 'text';
|
|
88
|
+
var customCells = props.cells;
|
|
89
|
+
if (customCells && customCells.edit && customCells.edit[editorSetting]) {
|
|
90
|
+
var CustomCell = customCells.edit[editorSetting];
|
|
91
|
+
return (React.createElement(CustomCell, __assign({}, props, { tdProps: tdProps }), content));
|
|
78
92
|
}
|
|
79
93
|
return props.render ?
|
|
80
94
|
props.render.call(undefined, defaultRendering, props) :
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { GridCellProps } from '../interfaces/GridCellProps';
|
|
3
3
|
/**
|
|
4
4
|
* @hidden
|
|
5
5
|
*/
|
|
6
|
-
export declare const GridGroupCell: (props: GridCellProps) =>
|
|
6
|
+
export declare const GridGroupCell: (props: GridCellProps) => JSX.Element | null;
|
|
@@ -24,6 +24,9 @@ export var GridGroupCell = function (props) {
|
|
|
24
24
|
var definedField = field || '';
|
|
25
25
|
var navigationAttributes = useTableKeyboardNavigation(props.id);
|
|
26
26
|
var localization = useLocalization();
|
|
27
|
+
var tdProps = null;
|
|
28
|
+
var td2Props = null;
|
|
29
|
+
var content = null;
|
|
27
30
|
var onKeyDownHandler = React.useCallback(function (event) {
|
|
28
31
|
if (event.isDefaultPrevented()) {
|
|
29
32
|
return;
|
|
@@ -45,42 +48,65 @@ export var GridGroupCell = function (props) {
|
|
|
45
48
|
}
|
|
46
49
|
}, [props.onContextMenu, props.dataItem, props.field]);
|
|
47
50
|
var renderCellCollapse = function (colspan, styles) {
|
|
51
|
+
var _a;
|
|
48
52
|
var baseMessage = expanded ? groupCollapse : groupExpand;
|
|
49
53
|
var message = localization.toLanguageString(baseMessage, messages[baseMessage]);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
54
|
+
tdProps = __assign((_a = { className: 'k-table-td', style: __assign(__assign({}, props.style), styles), colSpan: colspan, key: 'g-colspan', role: 'gridcell' }, _a['aria-selected'] = false, _a['aria-expanded'] = expanded, _a['aria-colindex'] = ariaColumnIndex, _a.onKeyDown = onKeyDownHandler, _a.onContextMenu = onContextMenu, _a), navigationAttributes);
|
|
55
|
+
content = (React.createElement("p", { className: "k-reset" },
|
|
56
|
+
React.createElement("a", { onClick: function (e) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
if (onChange) {
|
|
59
|
+
onChange({
|
|
60
|
+
dataItem: dataItem,
|
|
61
|
+
dataIndex: dataIndex,
|
|
62
|
+
syntheticEvent: e,
|
|
63
|
+
field: undefined,
|
|
64
|
+
value: !expanded
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, href: "#", tabIndex: -1, "aria-label": message },
|
|
68
|
+
React.createElement(IconWrap, { name: expanded ?
|
|
69
|
+
'caret-alt-down'
|
|
70
|
+
: isRtl ? 'caret-alt-left' : 'caret-alt-right', icon: expanded ?
|
|
71
|
+
caretAltDownIcon
|
|
72
|
+
: isRtl ? caretAltLeftIcon : caretAltRightIcon })),
|
|
73
|
+
((dataItem[definedField] instanceof Date) && dataItem[definedField].toString) ?
|
|
74
|
+
dataItem[definedField].toString() :
|
|
75
|
+
dataItem[definedField]));
|
|
76
|
+
return (React.createElement("td", __assign({}, tdProps), content));
|
|
72
77
|
};
|
|
73
78
|
if (columnIndex === undefined || level === undefined || columnIndex < level ||
|
|
74
79
|
columnsCount === undefined || rowType !== 'groupHeader' || dataItem[definedField] === undefined) {
|
|
75
|
-
|
|
80
|
+
tdProps = {
|
|
81
|
+
style: props.style,
|
|
82
|
+
key: 'g' + columnIndex,
|
|
83
|
+
className: classNames('k-table-td', 'k-group-cell', { 'k-grid-content-sticky': props.locked }),
|
|
84
|
+
role: 'gridcell',
|
|
85
|
+
onContextMenu: onContextMenu
|
|
86
|
+
};
|
|
87
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps)));
|
|
76
88
|
}
|
|
77
89
|
else if (columnIndex <= level && !props.locked) {
|
|
78
90
|
defaultRendering = renderCellCollapse(columnsCount - columnIndex, {});
|
|
79
91
|
}
|
|
80
92
|
else if (columnIndex <= level && props.locked) {
|
|
93
|
+
td2Props = {
|
|
94
|
+
className: 'k-table-td',
|
|
95
|
+
role: 'gridcell',
|
|
96
|
+
colSpan: (columnsCount - columnIndex),
|
|
97
|
+
style: { borderLeftWidth: 0, borderRightWidth: 0 },
|
|
98
|
+
onContextMenu: onContextMenu
|
|
99
|
+
};
|
|
81
100
|
defaultRendering = (React.createElement(React.Fragment, null,
|
|
82
101
|
renderCellCollapse(0, { position: 'sticky', zIndex: 2 }),
|
|
83
|
-
React.createElement("td",
|
|
102
|
+
React.createElement("td", __assign({}, td2Props))));
|
|
103
|
+
}
|
|
104
|
+
var rowTypeSetting = props.rowType || 'data';
|
|
105
|
+
var customCells = props.cells;
|
|
106
|
+
if (customCells && customCells.group
|
|
107
|
+
&& customCells.group[rowTypeSetting]) {
|
|
108
|
+
var CustomCell = customCells.group[rowTypeSetting];
|
|
109
|
+
return (React.createElement(CustomCell, __assign({}, props, { tdProps: tdProps, td2Props: td2Props }), content));
|
|
84
110
|
}
|
|
85
111
|
return render ?
|
|
86
112
|
render.call(undefined, defaultRendering, props) :
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { GridCellProps } from '../interfaces/GridCellProps';
|
|
3
3
|
/**
|
|
4
4
|
* @hidden
|
|
5
5
|
*/
|
|
6
|
-
export declare const GridHierarchyCell: (props: GridCellProps) =>
|
|
6
|
+
export declare const GridHierarchyCell: (props: GridCellProps) => JSX.Element | null;
|
|
@@ -21,6 +21,8 @@ import { minusIcon, plusIcon } from '@progress/kendo-svg-icons';
|
|
|
21
21
|
*/
|
|
22
22
|
export var GridHierarchyCell = function (props) {
|
|
23
23
|
var defaultRendering = null;
|
|
24
|
+
var tdProps = null;
|
|
25
|
+
var content = null;
|
|
24
26
|
var expanded = getNestedValue(props.field, props.dataItem);
|
|
25
27
|
var navigationAttributes = useTableKeyboardNavigation(props.id);
|
|
26
28
|
var localization = useLocalization();
|
|
@@ -40,26 +42,34 @@ export var GridHierarchyCell = function (props) {
|
|
|
40
42
|
}
|
|
41
43
|
}, [props.dataItem, props.dataIndex, props.field, props.onChange, expanded]);
|
|
42
44
|
if (props.rowType === 'groupFooter') {
|
|
45
|
+
tdProps = __assign({ className: 'k-table-td k-hierarchy-cell', role: 'gridcell' }, navigationAttributes);
|
|
43
46
|
defaultRendering =
|
|
44
|
-
React.createElement("td", __assign({
|
|
47
|
+
React.createElement("td", __assign({}, tdProps));
|
|
45
48
|
}
|
|
46
49
|
else if (props.rowType !== 'groupHeader') {
|
|
47
50
|
var baseMessage = expanded ? detailCollapse : detailExpand;
|
|
48
51
|
var message = localization.toLanguageString(baseMessage, messages[baseMessage]);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
tdProps = __assign({ className: 'k-table-td k-hierarchy-cell', onKeyDown: onKeyDownHandler, 'aria-expanded': expanded ? true : false, role: 'gridcell', 'aria-colindex': props.ariaColumnIndex }, navigationAttributes);
|
|
53
|
+
content = (React.createElement("a", { onClick: function (e) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
if (props.onChange) {
|
|
56
|
+
props.onChange({
|
|
57
|
+
dataItem: props.dataItem,
|
|
58
|
+
dataIndex: props.dataIndex,
|
|
59
|
+
syntheticEvent: e,
|
|
60
|
+
field: props.field,
|
|
61
|
+
value: !expanded
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, "aria-label": message, href: "#", tabIndex: -1 },
|
|
65
|
+
React.createElement(IconWrap, { name: expanded ? 'minus' : 'plus', icon: expanded ? minusIcon : plusIcon })));
|
|
66
|
+
defaultRendering = (React.createElement("td", __assign({}, tdProps), content));
|
|
67
|
+
}
|
|
68
|
+
var rowTypeSetting = props.rowType || 'data';
|
|
69
|
+
var customCells = props.cells;
|
|
70
|
+
if (customCells && customCells.hierarchy && customCells.hierarchy[rowTypeSetting]) {
|
|
71
|
+
var CustomCell = customCells.hierarchy[rowTypeSetting];
|
|
72
|
+
return (React.createElement(CustomCell, __assign({}, props, { tdProps: tdProps }), content));
|
|
63
73
|
}
|
|
64
74
|
return props.render ?
|
|
65
75
|
props.render.call(undefined, defaultRendering, props) :
|
|
@@ -17,6 +17,7 @@ import { useTableKeyboardNavigation } from '@progress/kendo-react-data-tools';
|
|
|
17
17
|
* @hidden
|
|
18
18
|
*/
|
|
19
19
|
export var GridSelectionCell = function (props) {
|
|
20
|
+
var _a;
|
|
20
21
|
var handleOnChange = React.useCallback(function (syntheticEvent) {
|
|
21
22
|
if (props.selectionChange) {
|
|
22
23
|
props.selectionChange({ syntheticEvent: syntheticEvent });
|
|
@@ -25,9 +26,18 @@ export var GridSelectionCell = function (props) {
|
|
|
25
26
|
var inputId = React.useMemo(function () { return guid(); }, []);
|
|
26
27
|
var selectedValue = getNestedValue(props.field, props.dataItem);
|
|
27
28
|
var navigationAttributes = useTableKeyboardNavigation(props.id);
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
React.createElement("
|
|
29
|
+
var tdProps = __assign((_a = { colSpan: props.colSpan, style: props.style, className: props.className }, _a['aria-colindex'] = props.ariaColumnIndex, _a.role = 'gridcell', _a), navigationAttributes);
|
|
30
|
+
var content = [
|
|
31
|
+
(React.createElement("input", { key: "1", checked: typeof selectedValue === 'boolean' && selectedValue, id: inputId, type: "checkbox", className: "k-checkbox k-checkbox-md k-rounded-md", onChange: handleOnChange })),
|
|
32
|
+
(React.createElement("label", { className: "k-checkbox-label", htmlFor: inputId, key: "2" }))
|
|
33
|
+
];
|
|
34
|
+
var defaultRendering = props.rowType !== 'groupHeader' ? (React.createElement("td", __assign({}, tdProps), content)) : null;
|
|
35
|
+
var rowTypeSetting = props.rowType || 'data';
|
|
36
|
+
var customCells = props.cells;
|
|
37
|
+
if (customCells && customCells.select && customCells.select[rowTypeSetting]) {
|
|
38
|
+
var CustomCell = customCells.select[rowTypeSetting];
|
|
39
|
+
return (React.createElement(CustomCell, __assign({}, props, { tdProps: tdProps }), content));
|
|
40
|
+
}
|
|
31
41
|
return props.render ?
|
|
32
42
|
props.render.call(undefined, defaultRendering, props) :
|
|
33
43
|
defaultRendering;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ExtendedColumnProps } from '../GridColumn';
|
|
3
|
+
import { GridCellsSettings } from '../interfaces/GridCellsSettings';
|
|
3
4
|
/**
|
|
4
5
|
* @hidden
|
|
5
6
|
*/
|
|
6
7
|
export interface FooterRowProps {
|
|
8
|
+
cells?: GridCellsSettings;
|
|
7
9
|
columns: ExtendedColumnProps[];
|
|
8
10
|
isRtl?: boolean;
|
|
9
11
|
ariaRowIndex: number;
|
|
@@ -25,7 +25,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
return __assign.apply(this, arguments);
|
|
26
26
|
};
|
|
27
27
|
import * as React from 'react';
|
|
28
|
-
import { footerColumns } from './../utils';
|
|
28
|
+
import { footerColumns, resolveCells } from './../utils';
|
|
29
29
|
import { classNames } from '@progress/kendo-react-common';
|
|
30
30
|
/**
|
|
31
31
|
* @hidden
|
|
@@ -36,17 +36,28 @@ var FooterRow = /** @class */ (function (_super) {
|
|
|
36
36
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
37
37
|
_this._element = null;
|
|
38
38
|
_this.renderCell = function (column, index) {
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
?
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
var _a;
|
|
40
|
+
var tdProps = (_a = {
|
|
41
|
+
colSpan: column.colSpan !== 1 ? column.colSpan : undefined,
|
|
42
|
+
style: column.left !== undefined
|
|
43
|
+
? !_this.props.isRtl
|
|
44
|
+
? { left: column.left, right: column.right }
|
|
45
|
+
: { left: column.right, right: column.left }
|
|
46
|
+
: {},
|
|
47
|
+
className: classNames('k-table-td', column.locked && column.left !== undefined ? 'k-grid-footer-sticky' : ''),
|
|
48
|
+
key: index,
|
|
49
|
+
role: 'columnfooter'
|
|
50
|
+
},
|
|
51
|
+
_a['aria-selected'] = false,
|
|
52
|
+
_a['aria-colindex'] = column.ariaColumnIndex,
|
|
53
|
+
_a);
|
|
48
54
|
var cellProps = __assign({ field: column.field, ariaColumnIndex: column.ariaColumnIndex }, tdProps);
|
|
49
|
-
|
|
55
|
+
var customCells = resolveCells(_this.props.cells, column.cells);
|
|
56
|
+
if (customCells && customCells.footerCell) {
|
|
57
|
+
var CustomCell = customCells.footerCell;
|
|
58
|
+
return React.createElement(CustomCell, __assign({}, cellProps, { tdProps: tdProps, index: index }));
|
|
59
|
+
}
|
|
60
|
+
return (column.footerCell && React.createElement(column.footerCell, __assign({}, cellProps, { key: index }))) || (React.createElement("td", __assign({}, tdProps)));
|
|
50
61
|
};
|
|
51
62
|
return _this;
|
|
52
63
|
}
|
|
@@ -3,6 +3,7 @@ import { CompositeFilterDescriptor, SortDescriptor } from '@progress/kendo-data-
|
|
|
3
3
|
import { ExtendedColumnProps } from '../GridColumn';
|
|
4
4
|
import { GridFilterCellProps } from '../interfaces/GridFilterCellProps';
|
|
5
5
|
import { GridFilterOperators } from '../interfaces/GridFilterOperators';
|
|
6
|
+
import { GridCellsSettings } from '../interfaces/GridCellsSettings';
|
|
6
7
|
/**
|
|
7
8
|
* @hidden
|
|
8
9
|
*/
|
|
@@ -11,6 +12,7 @@ export declare const FILTER_ROW_CLASS = "k-table-row k-filter-row";
|
|
|
11
12
|
* @hidden
|
|
12
13
|
*/
|
|
13
14
|
export interface FilterRowProps {
|
|
15
|
+
cells?: GridCellsSettings;
|
|
14
16
|
columns: ExtendedColumnProps[];
|
|
15
17
|
filter?: CompositeFilterDescriptor;
|
|
16
18
|
filterOperators: GridFilterOperators;
|
|
@@ -31,6 +31,7 @@ import { operatorMap, booleanFilterValues, getFilterType } from '../filterCommon
|
|
|
31
31
|
import { tableKeyboardNavigationTools as navigationTools, HeaderThElement } from '@progress/kendo-react-data-tools';
|
|
32
32
|
import { filterAriaLabel, messages } from '../messages';
|
|
33
33
|
import { classNames } from '@progress/kendo-react-common';
|
|
34
|
+
import { resolveCells } from '../utils';
|
|
34
35
|
/**
|
|
35
36
|
* @hidden
|
|
36
37
|
*/
|
|
@@ -119,9 +120,16 @@ var FilterRow = /** @class */ (function (_super) {
|
|
|
119
120
|
? { left: column.left, right: column.right }
|
|
120
121
|
: { left: column.right, right: column.left }
|
|
121
122
|
: {};
|
|
122
|
-
|
|
123
|
+
var thProps = __assign({ columnId: navigationTools.getFilterColumnId(column.id), navigatable: column.navigatable, style: style, className: classNames('k-table-th', _this.headerCellClassName(column.field, column.locked) || undefined), role: 'columnheader' }, ariaAttrs);
|
|
124
|
+
var content = (filterCellProps && (column.filterCell ?
|
|
123
125
|
React.createElement(column.filterCell, __assign({}, filterCellProps)) :
|
|
124
|
-
React.createElement(GridFilterCell, __assign({ size: _this.props.size }, filterCellProps))))
|
|
126
|
+
React.createElement(GridFilterCell, __assign({ size: _this.props.size }, filterCellProps))));
|
|
127
|
+
var customCells = resolveCells(_this.props.cells, column.cells);
|
|
128
|
+
if (customCells && customCells.filterCell) {
|
|
129
|
+
var CustomCell = customCells.filterCell;
|
|
130
|
+
return (React.createElement(CustomCell, __assign({ key: key }, filterCellProps, { thProps: thProps, index: index }), content));
|
|
131
|
+
}
|
|
132
|
+
return (React.createElement(HeaderThElement, __assign({ key: key }, thProps), content));
|
|
125
133
|
});
|
|
126
134
|
return React.createElement("tr", { className: FILTER_ROW_CLASS, "aria-rowindex": this.props.ariaRowIndex, role: "row" }, filterCells);
|
|
127
135
|
};
|
|
@@ -8,10 +8,12 @@ import { GridColumnProps } from '../interfaces/GridColumnProps';
|
|
|
8
8
|
import { GridHeaderCellProps } from '../interfaces/GridHeaderCellProps';
|
|
9
9
|
import { GridColumnMenuProps } from '../interfaces/GridColumnMenuProps';
|
|
10
10
|
import { GridFilterOperators } from '../interfaces/GridFilterOperators';
|
|
11
|
+
import { GridCellsSettings } from '../interfaces/GridCellsSettings';
|
|
11
12
|
/**
|
|
12
13
|
* @hidden
|
|
13
14
|
*/
|
|
14
15
|
export interface HeaderRowProps extends ColumnDraggableProps {
|
|
16
|
+
cells?: GridCellsSettings;
|
|
15
17
|
sortable?: GridSortSettings;
|
|
16
18
|
sortChange?: (descriptors: SortDescriptor[], e: React.SyntheticEvent<any>) => void;
|
|
17
19
|
sort?: SortDescriptor[];
|
|
@@ -34,6 +34,7 @@ import { HeaderThElement } from '@progress/kendo-react-data-tools';
|
|
|
34
34
|
import { registerForLocalization, provideLocalizationService as intl } from '@progress/kendo-react-intl';
|
|
35
35
|
import { messages, sortAriaLabel } from '../messages';
|
|
36
36
|
import { sortAscSmallIcon, sortDescSmallIcon } from '@progress/kendo-svg-icons';
|
|
37
|
+
import { resolveCells } from '../utils';
|
|
37
38
|
/**
|
|
38
39
|
* @hidden
|
|
39
40
|
*/
|
|
@@ -97,7 +98,7 @@ var HeaderRow = /** @class */ (function (_super) {
|
|
|
97
98
|
};
|
|
98
99
|
var key = (column.declarationIndex >= 0) ? ++_this.index : --_this.serviceIndex;
|
|
99
100
|
var HeaderCell = column.headerCell ? column.headerCell : GridHeaderCell;
|
|
100
|
-
var headerCell = (React.createElement(HeaderCell, { field: column.field, onClick: sortable && (function (e) { return _this.cellClick(e, column); }) || undefined, selectionChange: _this.props.selectionChange, title: column.title, selectionValue: column.headerSelectionValue, render: _this.props.cellRender, children: _this.sortIcon(sortIndex), columnMenuWrapperProps: {
|
|
101
|
+
var headerCell = (React.createElement(HeaderCell, { key: 1, field: column.field, onClick: sortable && (function (e) { return _this.cellClick(e, column); }) || undefined, selectionChange: _this.props.selectionChange, title: column.title, selectionValue: column.headerSelectionValue, render: _this.props.cellRender, children: _this.sortIcon(sortIndex), columnMenuWrapperProps: {
|
|
101
102
|
column: {
|
|
102
103
|
field: column.field,
|
|
103
104
|
filter: column.filter
|
|
@@ -114,16 +115,24 @@ var HeaderRow = /** @class */ (function (_super) {
|
|
|
114
115
|
onGroupChange: _this.props.groupChange,
|
|
115
116
|
columnMenu: columnMenu
|
|
116
117
|
} }));
|
|
117
|
-
|
|
118
|
+
var thProps = __assign(__assign({}, ariaAttrs), { key: key, colSpan: column.colSpan, rowSpan: column.rowSpan, className: className, style: style, columnId: column.id, navigatable: column.navigatable, onKeyDown: sortable && (function (e) { return _this.cellKeyDown(e, column); }) || undefined, role: 'columnheader' });
|
|
119
|
+
var content = [
|
|
118
120
|
headerCell,
|
|
119
|
-
_this.props.columnResize && _this.props.columnResize.resizable && column.resizable
|
|
120
|
-
React.createElement(ColumnResizer, { key: 2, resize: function (e, element, end) {
|
|
121
|
+
(_this.props.columnResize && _this.props.columnResize.resizable && column.resizable
|
|
122
|
+
&& React.createElement(ColumnResizer, { key: 2, resize: function (e, element, end) {
|
|
121
123
|
return _this.props.columnResize &&
|
|
122
124
|
_this.props.columnResize.dragHandler(e, column, element, end);
|
|
123
125
|
}, autofit: function (e) {
|
|
124
126
|
return _this.props.columnResize &&
|
|
125
127
|
_this.props.columnResize.dblClickHandler(e, [column.id]);
|
|
126
|
-
} }))
|
|
128
|
+
} }))
|
|
129
|
+
];
|
|
130
|
+
var customCells = resolveCells(_this.props.cells, column.cells);
|
|
131
|
+
if (customCells && customCells.headerCell) {
|
|
132
|
+
var CustomCell = customCells.headerCell;
|
|
133
|
+
return (React.createElement(CustomCell, { key: key, thProps: thProps, index: columnIndex }, content));
|
|
134
|
+
}
|
|
135
|
+
return (React.createElement(HeaderThElement, __assign({}, thProps, { key: key }), content));
|
|
127
136
|
}); };
|
|
128
137
|
_this.cellClick = _this.cellClick.bind(_this);
|
|
129
138
|
return _this;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { GridCellsSettings } from './GridCellsSettings';
|
|
2
3
|
import { GridRowType } from './GridRowType';
|
|
3
4
|
import { CellProps } from '@progress/kendo-react-data-tools';
|
|
4
5
|
/**
|
|
@@ -18,6 +19,10 @@ export interface GridCellProps extends Omit<CellProps, 'onChange' | 'render'> {
|
|
|
18
19
|
* The number of rendered columns in the Grid.
|
|
19
20
|
*/
|
|
20
21
|
columnsCount?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Sets a set of cells components that the Grid will render instead of the built-in cell.
|
|
24
|
+
*/
|
|
25
|
+
cells?: GridCellsSettings;
|
|
21
26
|
/**
|
|
22
27
|
* The type of the row.
|
|
23
28
|
*/
|