es-grid-template 1.7.23 → 1.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.d.ts +1 -0
- package/es/index.js +3 -1
- package/es/table-component/ColumnsChoose.d.ts +10 -0
- package/es/table-component/ColumnsChoose.js +557 -0
- package/es/table-component/ContextMenu.d.ts +20 -0
- package/es/table-component/ContextMenu.js +75 -0
- package/es/table-component/InternalTable.d.ts +9 -0
- package/es/table-component/InternalTable.js +295 -0
- package/es/table-component/TableContainer.d.ts +22 -0
- package/es/table-component/TableContainer.js +130 -0
- package/es/table-component/TableContainerEdit.d.ts +28 -0
- package/es/table-component/TableContainerEdit.js +1211 -0
- package/es/table-component/body/EditableCell.d.ts +16 -0
- package/es/table-component/body/EditableCell.js +1036 -0
- package/es/table-component/body/TableBody.d.ts +19 -0
- package/es/table-component/body/TableBody.js +64 -0
- package/es/table-component/body/TableBodyCell.d.ts +10 -0
- package/es/table-component/body/TableBodyCell.js +139 -0
- package/es/table-component/body/TableBodyCellEdit.d.ts +15 -0
- package/es/table-component/body/TableBodyCellEdit.js +814 -0
- package/es/table-component/body/TableBodyRow.d.ts +21 -0
- package/es/table-component/body/TableBodyRow.js +146 -0
- package/es/table-component/components/ControlCheckbox.d.ts +13 -0
- package/es/table-component/components/ControlCheckbox.js +87 -0
- package/es/table-component/components/EditForm/EditForm.d.ts +27 -0
- package/es/table-component/components/EditForm/EditForm.js +395 -0
- package/es/table-component/components/EditForm/index.d.ts +1 -0
- package/es/table-component/components/EditForm/index.js +1 -0
- package/es/table-component/components/InputControl/InputControl.d.ts +27 -0
- package/es/table-component/components/InputControl/InputControl.js +121 -0
- package/es/table-component/components/InputControl/index.d.ts +1 -0
- package/es/table-component/components/InputControl/index.js +1 -0
- package/es/table-component/components/async-select/index.d.ts +11 -0
- package/es/table-component/components/async-select/index.js +41 -0
- package/es/table-component/components/async-table-select/index.d.ts +11 -0
- package/es/table-component/components/async-table-select/index.js +43 -0
- package/es/table-component/components/checkbox-control/index.d.ts +13 -0
- package/es/table-component/components/checkbox-control/index.js +40 -0
- package/es/table-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/es/table-component/components/checkbox-filter/CheckboxFilter.js +240 -0
- package/es/table-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/es/table-component/components/checkbox-filter/FilterSearch.js +36 -0
- package/es/table-component/components/command/Command.d.ts +9 -0
- package/es/table-component/components/command/Command.js +28 -0
- package/es/table-component/components/number/index.d.ts +10 -0
- package/es/table-component/components/number/index.js +42 -0
- package/es/table-component/components/number-range/index.d.ts +11 -0
- package/es/table-component/components/number-range/index.js +66 -0
- package/es/table-component/features/operator.d.ts +24 -0
- package/es/table-component/features/operator.js +62 -0
- package/es/table-component/footer/TableFooter.d.ts +13 -0
- package/es/table-component/footer/TableFooter.js +33 -0
- package/es/table-component/footer/TableFooterCell.d.ts +10 -0
- package/es/table-component/footer/TableFooterCell.js +24 -0
- package/es/table-component/footer/TableFooterRow.d.ts +14 -0
- package/es/table-component/footer/TableFooterRow.js +71 -0
- package/es/table-component/header/TableHead.d.ts +14 -0
- package/es/table-component/header/TableHead.js +60 -0
- package/es/table-component/header/TableHeadCell.d.ts +14 -0
- package/es/table-component/header/TableHeadCell.js +324 -0
- package/es/table-component/header/TableHeadRow.d.ts +16 -0
- package/es/table-component/header/TableHeadRow.js +86 -0
- package/es/table-component/header/renderFilter.d.ts +20 -0
- package/es/table-component/header/renderFilter.js +281 -0
- package/es/table-component/hook/constant.d.ts +73 -0
- package/es/table-component/hook/constant.js +240 -0
- package/es/table-component/hook/useColumns.d.ts +11 -0
- package/es/table-component/hook/useColumns.js +209 -0
- package/es/table-component/hook/useFilterOperator.d.ts +7 -0
- package/es/table-component/hook/useFilterOperator.js +33 -0
- package/es/table-component/hook/utils.d.ts +121 -0
- package/es/table-component/hook/utils.js +1727 -0
- package/es/table-component/index.d.ts +5 -0
- package/es/table-component/index.js +2 -0
- package/es/table-component/style.scss +1083 -0
- package/es/table-component/table/Grid.d.ts +23 -0
- package/es/table-component/table/Grid.js +310 -0
- package/es/table-component/table/GridEdit.d.ts +23 -0
- package/es/table-component/table/GridEdit.js +282 -0
- package/es/table-component/type.d.ts +482 -0
- package/es/table-component/type.js +1 -0
- package/es/table-component/useContext.d.ts +119 -0
- package/es/table-component/useContext.js +61 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +8 -1
- package/lib/table-component/ColumnsChoose.d.ts +10 -0
- package/lib/table-component/ColumnsChoose.js +568 -0
- package/lib/table-component/ContextMenu.d.ts +20 -0
- package/lib/table-component/ContextMenu.js +85 -0
- package/lib/table-component/InternalTable.d.ts +9 -0
- package/lib/table-component/InternalTable.js +299 -0
- package/lib/table-component/TableContainer.d.ts +22 -0
- package/lib/table-component/TableContainer.js +137 -0
- package/lib/table-component/TableContainerEdit.d.ts +28 -0
- package/lib/table-component/TableContainerEdit.js +1220 -0
- package/lib/table-component/body/EditableCell.d.ts +16 -0
- package/lib/table-component/body/EditableCell.js +1038 -0
- package/lib/table-component/body/TableBody.d.ts +19 -0
- package/lib/table-component/body/TableBody.js +72 -0
- package/lib/table-component/body/TableBodyCell.d.ts +10 -0
- package/lib/table-component/body/TableBodyCell.js +148 -0
- package/lib/table-component/body/TableBodyCellEdit.d.ts +15 -0
- package/lib/table-component/body/TableBodyCellEdit.js +821 -0
- package/lib/table-component/body/TableBodyRow.d.ts +21 -0
- package/lib/table-component/body/TableBodyRow.js +153 -0
- package/lib/table-component/components/ControlCheckbox.d.ts +13 -0
- package/lib/table-component/components/ControlCheckbox.js +95 -0
- package/lib/table-component/components/EditForm/EditForm.d.ts +27 -0
- package/lib/table-component/components/EditForm/EditForm.js +406 -0
- package/lib/table-component/components/EditForm/index.d.ts +1 -0
- package/lib/table-component/components/EditForm/index.js +16 -0
- package/lib/table-component/components/InputControl/InputControl.d.ts +27 -0
- package/lib/table-component/components/InputControl/InputControl.js +131 -0
- package/lib/table-component/components/InputControl/index.d.ts +1 -0
- package/lib/table-component/components/InputControl/index.js +16 -0
- package/lib/table-component/components/async-select/index.d.ts +11 -0
- package/lib/table-component/components/async-select/index.js +49 -0
- package/lib/table-component/components/async-table-select/index.d.ts +11 -0
- package/lib/table-component/components/async-table-select/index.js +51 -0
- package/lib/table-component/components/checkbox-control/index.d.ts +13 -0
- package/lib/table-component/components/checkbox-control/index.js +48 -0
- package/lib/table-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/lib/table-component/components/checkbox-filter/CheckboxFilter.js +249 -0
- package/lib/table-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/lib/table-component/components/checkbox-filter/FilterSearch.js +44 -0
- package/lib/table-component/components/command/Command.d.ts +9 -0
- package/lib/table-component/components/command/Command.js +37 -0
- package/lib/table-component/components/number/index.d.ts +10 -0
- package/lib/table-component/components/number/index.js +50 -0
- package/lib/table-component/components/number-range/index.d.ts +11 -0
- package/lib/table-component/components/number-range/index.js +74 -0
- package/lib/table-component/features/operator.d.ts +24 -0
- package/lib/table-component/features/operator.js +67 -0
- package/lib/table-component/footer/TableFooter.d.ts +13 -0
- package/lib/table-component/footer/TableFooter.js +42 -0
- package/lib/table-component/footer/TableFooterCell.d.ts +10 -0
- package/lib/table-component/footer/TableFooterCell.js +32 -0
- package/lib/table-component/footer/TableFooterRow.d.ts +14 -0
- package/lib/table-component/footer/TableFooterRow.js +79 -0
- package/lib/table-component/header/TableHead.d.ts +14 -0
- package/lib/table-component/header/TableHead.js +69 -0
- package/lib/table-component/header/TableHeadCell.d.ts +14 -0
- package/lib/table-component/header/TableHeadCell.js +333 -0
- package/lib/table-component/header/TableHeadRow.d.ts +16 -0
- package/lib/table-component/header/TableHeadRow.js +94 -0
- package/lib/table-component/header/renderFilter.d.ts +20 -0
- package/lib/table-component/header/renderFilter.js +291 -0
- package/lib/table-component/hook/constant.d.ts +73 -0
- package/lib/table-component/hook/constant.js +247 -0
- package/lib/table-component/hook/useColumns.d.ts +11 -0
- package/lib/table-component/hook/useColumns.js +220 -0
- package/lib/table-component/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-component/hook/useFilterOperator.js +40 -0
- package/lib/table-component/hook/utils.d.ts +121 -0
- package/lib/table-component/hook/utils.js +1817 -0
- package/lib/table-component/index.d.ts +5 -0
- package/lib/table-component/index.js +9 -0
- package/lib/table-component/style.scss +1083 -0
- package/lib/table-component/table/Grid.d.ts +23 -0
- package/lib/table-component/table/Grid.js +313 -0
- package/lib/table-component/table/GridEdit.d.ts +23 -0
- package/lib/table-component/table/GridEdit.js +284 -0
- package/lib/table-component/type.d.ts +482 -0
- package/lib/table-component/type.js +5 -0
- package/lib/table-component/useContext.d.ts +119 -0
- package/lib/table-component/useContext.js +67 -0
- package/package.json +3 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Column, Table } from "@tanstack/react-table";
|
|
2
|
+
import type { Virtualizer } from "@tanstack/react-virtual";
|
|
3
|
+
import type { CommandClick } from "../type";
|
|
4
|
+
import React from "react";
|
|
5
|
+
interface TableBodyProps<T> {
|
|
6
|
+
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
7
|
+
table: Table<T>;
|
|
8
|
+
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
virtualPaddingLeft: number | undefined;
|
|
10
|
+
virtualPaddingRight: number | undefined;
|
|
11
|
+
fixedLeftColumns: Column<T, unknown>[];
|
|
12
|
+
fixedRightColumns: Column<T, unknown>[];
|
|
13
|
+
commandClick?: (args: CommandClick) => void;
|
|
14
|
+
editAble?: boolean;
|
|
15
|
+
tableId: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
declare const TableBody: <RecordType extends object>({ columnVirtualizer, table, tableContainerRef, virtualPaddingLeft, virtualPaddingRight, fixedLeftColumns, fixedRightColumns, tableId, ...rest }: TableBodyProps<RecordType>) => React.JSX.Element;
|
|
19
|
+
export default TableBody;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _TableBodyRow = _interopRequireDefault(require("./TableBodyRow"));
|
|
10
|
+
var _reactVirtual = require("@tanstack/react-virtual");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _useContext = require("../useContext");
|
|
13
|
+
// import type { Dispatch, SetStateAction } from "react";
|
|
14
|
+
|
|
15
|
+
const TableBody = ({
|
|
16
|
+
columnVirtualizer,
|
|
17
|
+
table,
|
|
18
|
+
tableContainerRef,
|
|
19
|
+
virtualPaddingLeft,
|
|
20
|
+
virtualPaddingRight,
|
|
21
|
+
fixedLeftColumns,
|
|
22
|
+
fixedRightColumns,
|
|
23
|
+
tableId,
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
26
|
+
const {
|
|
27
|
+
rows
|
|
28
|
+
} = table.getRowModel();
|
|
29
|
+
const {
|
|
30
|
+
editingKey,
|
|
31
|
+
prefix
|
|
32
|
+
} = _react.default.useContext(_useContext.TableContext);
|
|
33
|
+
|
|
34
|
+
//dynamic row height virtualization - alternatively you could use a simpler fixed row height strategy without the need for `measureElement`
|
|
35
|
+
const rowVirtualizer = (0, _reactVirtual.useVirtualizer)({
|
|
36
|
+
count: rows.length,
|
|
37
|
+
estimateSize: () => 36,
|
|
38
|
+
//estimate row height for accurate scrollbar dragging
|
|
39
|
+
getScrollElement: () => tableContainerRef.current,
|
|
40
|
+
//measure dynamic row height, except in firefox because it measures table border height incorrectly
|
|
41
|
+
measureElement: typeof window !== 'undefined' && navigator.userAgent.indexOf('Firefox') === -1 ? element => element?.getBoundingClientRect().height : undefined,
|
|
42
|
+
overscan: 3
|
|
43
|
+
});
|
|
44
|
+
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("tbody", {
|
|
46
|
+
className: `${prefix}-grid-tbody`,
|
|
47
|
+
style: {
|
|
48
|
+
display: 'grid',
|
|
49
|
+
height: `${rowVirtualizer.getTotalSize()}px`,
|
|
50
|
+
//tells scrollbar how big the table is
|
|
51
|
+
position: 'relative' //needed for absolute positioning of rows
|
|
52
|
+
}
|
|
53
|
+
}, virtualRows.map(virtualRow => {
|
|
54
|
+
const row = rows[virtualRow.index];
|
|
55
|
+
const isEditing = row.id === editingKey;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_TableBodyRow.default, (0, _extends2.default)({}, rest, {
|
|
57
|
+
table: table,
|
|
58
|
+
tableId: tableId,
|
|
59
|
+
key: row.id,
|
|
60
|
+
row: row,
|
|
61
|
+
columnVirtualizer: columnVirtualizer,
|
|
62
|
+
rowVirtualizer: rowVirtualizer,
|
|
63
|
+
virtualPaddingLeft: virtualPaddingLeft,
|
|
64
|
+
virtualPaddingRight: virtualPaddingRight,
|
|
65
|
+
virtualRow: virtualRow,
|
|
66
|
+
fixedLeftColumns: fixedLeftColumns,
|
|
67
|
+
fixedRightColumns: fixedRightColumns,
|
|
68
|
+
isEditing: isEditing
|
|
69
|
+
}));
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
var _default = exports.default = TableBody;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Cell, Table } from "@tanstack/react-table";
|
|
2
|
+
import type { CommandClick } from "../type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface TableBodyCellProps<T> {
|
|
5
|
+
cell: Cell<T, unknown>;
|
|
6
|
+
commandClick?: (args: CommandClick) => void;
|
|
7
|
+
table: Table<T>;
|
|
8
|
+
}
|
|
9
|
+
declare const TableBodyCell: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
|
|
10
|
+
export default TableBodyCell;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _reactTable = require("@tanstack/react-table");
|
|
9
|
+
var _space = _interopRequireDefault(require("rc-master-ui/es/space"));
|
|
10
|
+
var _Command = _interopRequireDefault(require("../components/command/Command"));
|
|
11
|
+
var _utils = require("../hook/utils");
|
|
12
|
+
var _constant = require("../hook/constant");
|
|
13
|
+
var _Checkbox = _interopRequireDefault(require("rc-master-ui/lib/checkbox/Checkbox"));
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _useContext = require("../useContext");
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
const renderCellIndex = props => {
|
|
20
|
+
const {
|
|
21
|
+
parrents,
|
|
22
|
+
cell
|
|
23
|
+
} = props;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("span", null, parrents.map(pr => {
|
|
25
|
+
return `${pr.index + 1}.`;
|
|
26
|
+
}), cell.row.index + 1);
|
|
27
|
+
};
|
|
28
|
+
const renderCommand = args => {
|
|
29
|
+
const {
|
|
30
|
+
cell,
|
|
31
|
+
commandClick
|
|
32
|
+
} = args;
|
|
33
|
+
const col = cell.column.columnDef.meta ?? {};
|
|
34
|
+
const record = cell.row.original;
|
|
35
|
+
|
|
36
|
+
// const commandItems = args.cell.column.columnDef?.meta?.commandItems ?? []
|
|
37
|
+
|
|
38
|
+
const commands = col.commandItems ? col.commandItems.map(it => {
|
|
39
|
+
return {
|
|
40
|
+
...it,
|
|
41
|
+
visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
|
|
42
|
+
};
|
|
43
|
+
}) : [];
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_space.default, null, commands.filter(it => it.visible !== false).map(item => {
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_Command.default, {
|
|
46
|
+
key: item.id,
|
|
47
|
+
item: item,
|
|
48
|
+
record: record,
|
|
49
|
+
onClick: () => {
|
|
50
|
+
commandClick?.({
|
|
51
|
+
id: item.id,
|
|
52
|
+
// rowId: getRowKey(record, index) as any,
|
|
53
|
+
rowId: record.rowId,
|
|
54
|
+
rowData: record,
|
|
55
|
+
index: cell.row.index
|
|
56
|
+
// rows: [...resource]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
const renderSelection = args => {
|
|
63
|
+
const {
|
|
64
|
+
row
|
|
65
|
+
} = args.cell;
|
|
66
|
+
const {
|
|
67
|
+
selectionSettings,
|
|
68
|
+
setIsSelectionChange
|
|
69
|
+
} = args;
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
71
|
+
style: {
|
|
72
|
+
|
|
73
|
+
// paddingLeft: `${row.depth * 2}rem`,
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
76
|
+
checked: row.getIsSelected() || row.getIsAllSubRowsSelected(),
|
|
77
|
+
indeterminate: row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' && selectionSettings.type !== 'single'
|
|
78
|
+
// indeterminate={row.getIsSomeSelected() }
|
|
79
|
+
,
|
|
80
|
+
onChange: e => {
|
|
81
|
+
row.getToggleSelectedHandler()(e);
|
|
82
|
+
setIsSelectionChange({
|
|
83
|
+
isChange: true,
|
|
84
|
+
type: 'rowSelected',
|
|
85
|
+
rowData: row.original
|
|
86
|
+
});
|
|
87
|
+
// row.toggleSelected()
|
|
88
|
+
|
|
89
|
+
// table.setRowSelection({
|
|
90
|
+
// [row.id]: true
|
|
91
|
+
// })
|
|
92
|
+
}
|
|
93
|
+
})));
|
|
94
|
+
};
|
|
95
|
+
const TableBodyCell = props => {
|
|
96
|
+
const {
|
|
97
|
+
cell,
|
|
98
|
+
commandClick,
|
|
99
|
+
table
|
|
100
|
+
} = props;
|
|
101
|
+
const {
|
|
102
|
+
prefix,
|
|
103
|
+
setIsSelectionChange,
|
|
104
|
+
selectionSettings
|
|
105
|
+
} = (0, _react.useContext)(_useContext.TableContext);
|
|
106
|
+
const parrents = cell.row.getParentRows();
|
|
107
|
+
const isPinned = cell.column.getIsPinned();
|
|
108
|
+
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
109
|
+
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
111
|
+
key: cell.id,
|
|
112
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
113
|
+
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
114
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
115
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
|
|
116
|
+
}),
|
|
117
|
+
style: {
|
|
118
|
+
display: 'flex',
|
|
119
|
+
width: cell.column.getSize(),
|
|
120
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
121
|
+
},
|
|
122
|
+
onClick: event => {
|
|
123
|
+
const element = event.target;
|
|
124
|
+
const container = document.querySelector(".ui-rc-table-row-expand");
|
|
125
|
+
const isInsideContainer = element.closest(".ui-rc-table-row-expand") && container;
|
|
126
|
+
if (!isInsideContainer && selectionSettings?.checkboxOnly !== true || (0, _utils.isNullOrUndefined)(selectionSettings?.mode)) {
|
|
127
|
+
cell.row.getToggleSelectedHandler()(event);
|
|
128
|
+
setIsSelectionChange({
|
|
129
|
+
isChange: true,
|
|
130
|
+
type: 'rowSelected',
|
|
131
|
+
rowData: cell.row.original
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, cell.column.id === "#" && renderCellIndex({
|
|
136
|
+
parrents,
|
|
137
|
+
cell
|
|
138
|
+
}), cell.column.id === "command" && renderCommand({
|
|
139
|
+
cell,
|
|
140
|
+
commandClick
|
|
141
|
+
}), cell.column.id === "selection_column" && renderSelection({
|
|
142
|
+
cell,
|
|
143
|
+
table,
|
|
144
|
+
selectionSettings,
|
|
145
|
+
setIsSelectionChange
|
|
146
|
+
}), !_constant.nonActionColumn.includes(cell.column.id) && (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()));
|
|
147
|
+
};
|
|
148
|
+
var _default = exports.default = TableBodyCell;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Cell, Table } from "@tanstack/react-table";
|
|
2
|
+
import type { CommandClick } from "../type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { Virtualizer } from "@tanstack/react-virtual";
|
|
5
|
+
interface TableBodyCellProps<T> {
|
|
6
|
+
table: Table<T>;
|
|
7
|
+
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
|
|
8
|
+
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
9
|
+
tableId: string;
|
|
10
|
+
cell: Cell<T, unknown>;
|
|
11
|
+
commandClick?: (args: CommandClick) => void;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
declare const TableBodyCellEdit: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
|
|
15
|
+
export default TableBodyCellEdit;
|