carbon-react 119.4.1 → 119.4.2
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/esm/__spec_helper__/test-utils.d.ts +1 -1
- package/esm/components/flat-table/cell-sizes.style.d.ts +28 -0
- package/esm/components/flat-table/flat-table-body/flat-table-body.component.d.ts +7 -0
- package/esm/components/flat-table/flat-table-body/flat-table-body.component.js +3 -2
- package/esm/components/flat-table/flat-table-body/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +9 -0
- package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +6 -16
- package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +4 -0
- package/esm/components/flat-table/flat-table-body-draggable/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +69 -0
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +7 -69
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.style.d.ts +10 -0
- package/esm/components/flat-table/flat-table-cell/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +45 -0
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +1 -39
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.d.ts +6 -0
- package/esm/components/flat-table/flat-table-checkbox/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-head/flat-table-head.component.d.ts +7 -0
- package/esm/components/flat-table/flat-table-head/flat-table-head.component.js +8 -13
- package/esm/components/flat-table/flat-table-head/flat-table-head.style.d.ts +2 -0
- package/esm/components/flat-table/flat-table-head/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +3 -0
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.d.ts +55 -0
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +7 -49
- package/esm/components/flat-table/flat-table-header/flat-table-header.style.d.ts +10 -0
- package/esm/components/flat-table/flat-table-header/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +18 -0
- package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +13 -19
- package/esm/components/flat-table/flat-table-row/flat-table-row.component.d.ts +56 -0
- package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +43 -67
- package/esm/components/flat-table/flat-table-row/flat-table-row.style.d.ts +18 -0
- package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +2 -3
- package/esm/components/flat-table/flat-table-row/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +71 -0
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +9 -51
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.d.ts +6 -0
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +7 -7
- package/esm/components/flat-table/flat-table-row-header/index.d.ts +2 -2
- package/esm/components/flat-table/flat-table.component.d.ts +42 -0
- package/esm/components/flat-table/flat-table.component.js +51 -92
- package/esm/components/flat-table/flat-table.config.d.ts +2 -0
- package/esm/components/flat-table/flat-table.style.d.ts +15 -0
- package/esm/components/flat-table/flat-table.style.js +36 -59
- package/esm/components/flat-table/index.d.ts +22 -13
- package/esm/components/flat-table/sort/index.d.ts +2 -2
- package/esm/components/flat-table/sort/sort.component.d.ts +11 -0
- package/esm/components/flat-table/sort/sort.component.js +1 -10
- package/esm/components/flat-table/sort/sort.style.d.ts +4 -0
- package/lib/__spec_helper__/test-utils.d.ts +1 -1
- package/lib/components/flat-table/cell-sizes.style.d.ts +28 -0
- package/lib/components/flat-table/flat-table-body/flat-table-body.component.d.ts +7 -0
- package/lib/components/flat-table/flat-table-body/flat-table-body.component.js +4 -3
- package/lib/components/flat-table/flat-table-body/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +9 -0
- package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +7 -16
- package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +4 -0
- package/lib/components/flat-table/flat-table-body-draggable/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +69 -0
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +8 -69
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.style.d.ts +10 -0
- package/lib/components/flat-table/flat-table-cell/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +45 -0
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +2 -39
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.d.ts +6 -0
- package/lib/components/flat-table/flat-table-checkbox/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-head/flat-table-head.component.d.ts +7 -0
- package/lib/components/flat-table/flat-table-head/flat-table-head.component.js +8 -12
- package/lib/components/flat-table/flat-table-head/flat-table-head.style.d.ts +2 -0
- package/lib/components/flat-table/flat-table-head/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +3 -0
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.d.ts +55 -0
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +8 -49
- package/lib/components/flat-table/flat-table-header/flat-table-header.style.d.ts +10 -0
- package/lib/components/flat-table/flat-table-header/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +18 -0
- package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +14 -20
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.d.ts +56 -0
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +44 -68
- package/lib/components/flat-table/flat-table-row/flat-table-row.style.d.ts +18 -0
- package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +2 -3
- package/lib/components/flat-table/flat-table-row/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +71 -0
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +10 -51
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.d.ts +6 -0
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +7 -7
- package/lib/components/flat-table/flat-table-row-header/index.d.ts +2 -2
- package/lib/components/flat-table/flat-table.component.d.ts +42 -0
- package/lib/components/flat-table/flat-table.component.js +51 -91
- package/lib/components/flat-table/flat-table.config.d.ts +2 -0
- package/lib/components/flat-table/flat-table.style.d.ts +15 -0
- package/lib/components/flat-table/flat-table.style.js +36 -59
- package/lib/components/flat-table/index.d.ts +22 -13
- package/lib/components/flat-table/sort/index.d.ts +2 -2
- package/lib/components/flat-table/sort/sort.component.d.ts +11 -0
- package/lib/components/flat-table/sort/sort.component.js +1 -10
- package/lib/components/flat-table/sort/sort.style.d.ts +4 -0
- package/package.json +1 -1
- package/esm/components/flat-table/flat-table-body/flat-table-body.d.ts +0 -10
- package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.d.ts +0 -14
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.d.ts +0 -28
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +0 -20
- package/esm/components/flat-table/flat-table-head/flat-table-head.d.ts +0 -10
- package/esm/components/flat-table/flat-table-header/flat-table-header.d.ts +0 -27
- package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.d.ts +0 -20
- package/esm/components/flat-table/flat-table-row/flat-table-row.d.ts +0 -31
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +0 -28
- package/esm/components/flat-table/flat-table.d.ts +0 -37
- package/esm/components/flat-table/sort/sort.d.ts +0 -14
- package/lib/components/flat-table/flat-table-body/flat-table-body.d.ts +0 -10
- package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.d.ts +0 -14
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.d.ts +0 -28
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +0 -20
- package/lib/components/flat-table/flat-table-head/flat-table-head.d.ts +0 -10
- package/lib/components/flat-table/flat-table-header/flat-table-header.d.ts +0 -27
- package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.d.ts +0 -20
- package/lib/components/flat-table/flat-table-row/flat-table-row.d.ts +0 -31
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +0 -28
- package/lib/components/flat-table/flat-table.d.ts +0 -37
- package/lib/components/flat-table/sort/sort.d.ts +0 -14
package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.FlatTableRowDraggable = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactDnd = require("react-dnd");
|
|
9
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _reactDnd = require("react-dnd");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const FlatTableRowDraggable = _ref => {
|
|
12
12
|
let {
|
|
@@ -15,7 +15,7 @@ const FlatTableRowDraggable = _ref => {
|
|
|
15
15
|
findItem,
|
|
16
16
|
moveItem
|
|
17
17
|
} = _ref;
|
|
18
|
-
const originalIndex = findItem(id).index;
|
|
18
|
+
const originalIndex = Number(findItem?.(id).index);
|
|
19
19
|
const [{
|
|
20
20
|
isDragging
|
|
21
21
|
}, drag] = (0, _reactDnd.useDrag)({
|
|
@@ -34,22 +34,19 @@ const FlatTableRowDraggable = _ref => {
|
|
|
34
34
|
} = monitor.getItem();
|
|
35
35
|
const didDrop = monitor.didDrop();
|
|
36
36
|
if (!didDrop) {
|
|
37
|
-
moveItem(droppedId, oIndex);
|
|
37
|
+
moveItem?.(droppedId, Number(oIndex));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
const [, drop] = (0, _reactDnd.useDrop)({
|
|
42
42
|
accept: "flatTableRow",
|
|
43
43
|
canDrop: () => false,
|
|
44
|
-
hover(
|
|
45
|
-
|
|
46
|
-
id: draggedId
|
|
47
|
-
} = _ref2;
|
|
48
|
-
if (draggedId !== id) {
|
|
44
|
+
hover(item) {
|
|
45
|
+
if (item?.id !== id && findItem) {
|
|
49
46
|
const {
|
|
50
47
|
index: overIndex
|
|
51
48
|
} = findItem(id);
|
|
52
|
-
moveItem(
|
|
49
|
+
moveItem?.(item?.id, Number(overIndex));
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
});
|
|
@@ -60,17 +57,14 @@ const FlatTableRowDraggable = _ref => {
|
|
|
60
57
|
ref: node => drag(drop(node))
|
|
61
58
|
});
|
|
62
59
|
};
|
|
60
|
+
exports.FlatTableRowDraggable = FlatTableRowDraggable;
|
|
63
61
|
FlatTableRowDraggable.propTypes = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
68
|
-
|
|
69
|
-
findItem: _propTypes.default.func.isRequired,
|
|
70
|
-
/** function to reposition an item in the list of draggable items */
|
|
71
|
-
moveItem: _propTypes.default.func.isRequired,
|
|
72
|
-
/** item is draggable */
|
|
73
|
-
draggable: _propTypes.default.bool
|
|
62
|
+
"children": _propTypes.default.node,
|
|
63
|
+
"draggable": _propTypes.default.bool,
|
|
64
|
+
"findItem": _propTypes.default.func,
|
|
65
|
+
"id": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
66
|
+
"moveItem": _propTypes.default.func
|
|
74
67
|
};
|
|
68
|
+
FlatTableRowDraggable.displayName = "FlatTableRowDraggable";
|
|
75
69
|
var _default = FlatTableRowDraggable;
|
|
76
70
|
exports.default = _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TableBorderSize } from "..";
|
|
3
|
+
import { FlatTableRowDraggableProps } from "./__internal__/flat-table-row-draggable.component";
|
|
4
|
+
export interface FlatTableRowProps {
|
|
5
|
+
/** Overrides default cell color, provide design token, any color from palette or any valid css color value. */
|
|
6
|
+
bgColor?: string;
|
|
7
|
+
/** Array of FlatTableHeader or FlatTableCell. FlatTableRowHeader could also be passed. */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** Allows the row to be expanded, must be used with the `subRows` prop. */
|
|
10
|
+
expandable?: boolean;
|
|
11
|
+
/** Sets an expandable row to be expanded on start */
|
|
12
|
+
expanded?: boolean;
|
|
13
|
+
/** Area to click to open sub rows when expandable. Default is `wholeRow` */
|
|
14
|
+
expandableArea?: "wholeRow" | "firstColumn";
|
|
15
|
+
/** Allows developers to manually control highlighted state for the row. */
|
|
16
|
+
highlighted?: boolean;
|
|
17
|
+
/** Sets the color of the bottom border in the row */
|
|
18
|
+
horizontalBorderColor?: string;
|
|
19
|
+
/** Sets the weight of the bottom border in the row */
|
|
20
|
+
horizontalBorderSize?: TableBorderSize;
|
|
21
|
+
/** Function to handle click event. If provided the Component could be focused with tab key. */
|
|
22
|
+
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
23
|
+
/** Allows developers to manually control selected state for the row. */
|
|
24
|
+
selected?: boolean;
|
|
25
|
+
/** Sub rows to be shown when the row is expanded, must be used with the `expandable` prop. */
|
|
26
|
+
subRows?: React.ReactNode;
|
|
27
|
+
/** @ignore @private */
|
|
28
|
+
isSubRow?: boolean;
|
|
29
|
+
/** @ignore @private */
|
|
30
|
+
isFirstSubRow?: boolean;
|
|
31
|
+
/** @ignore @private position in header if multiple rows */
|
|
32
|
+
stickyOffset?: number;
|
|
33
|
+
/** @ignore @private applies a border-left to the first child */
|
|
34
|
+
applyBorderLeft?: boolean;
|
|
35
|
+
/** ID for use in drag and drop functionality
|
|
36
|
+
* @private
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
id?: string | number;
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* @ignore
|
|
43
|
+
*/
|
|
44
|
+
findItem?: FlatTableRowDraggableProps["findItem"];
|
|
45
|
+
/**
|
|
46
|
+
* @private
|
|
47
|
+
* @ignore
|
|
48
|
+
*/
|
|
49
|
+
moveItem?: FlatTableRowDraggableProps["moveItem"];
|
|
50
|
+
/** @ignore @private position in header if multiple rows */
|
|
51
|
+
draggable?: boolean;
|
|
52
|
+
/** @ignore @private */
|
|
53
|
+
ref?: React.RefObject<HTMLTableRowElement>;
|
|
54
|
+
}
|
|
55
|
+
export declare const FlatTableRow: React.ForwardRefExoticComponent<Pick<FlatTableRowProps, "draggable" | "id" | "children" | "onClick" | "selected" | "bgColor" | "expanded" | "findItem" | "moveItem" | "highlighted" | "expandable" | "horizontalBorderColor" | "stickyOffset" | "isSubRow" | "isFirstSubRow" | "applyBorderLeft" | "horizontalBorderSize" | "expandableArea" | "subRows"> & React.RefAttributes<HTMLTableRowElement>>;
|
|
56
|
+
export default FlatTableRow;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.FlatTableRow = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
@@ -44,16 +44,18 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
44
44
|
} = _ref;
|
|
45
45
|
const internalId = (0, _react.useRef)(id ?? (0, _guid.default)());
|
|
46
46
|
const [isExpanded, setIsExpanded] = (0, _react.useState)(expanded);
|
|
47
|
-
let rowRef = (0, _react.useRef)();
|
|
48
|
-
if (ref)
|
|
47
|
+
let rowRef = (0, _react.useRef)(null);
|
|
48
|
+
if (ref) {
|
|
49
|
+
rowRef = ref;
|
|
50
|
+
}
|
|
49
51
|
const firstColumnExpandable = expandableArea === "firstColumn";
|
|
50
52
|
const [leftStickyCellWidths, setLeftStickyCellWidths] = (0, _react.useState)([]);
|
|
51
53
|
const [rightStickyCellWidths, setRightStickyCellWidths] = (0, _react.useState)([]);
|
|
52
54
|
const [leftPositions, setLeftPositions] = (0, _react.useState)([]);
|
|
53
55
|
const [rightPositions, setRightPositions] = (0, _react.useState)([]);
|
|
54
56
|
const childrenArray = (0, _react.useMemo)(() => _react.default.Children.toArray(children), [children]);
|
|
55
|
-
const lhsRowHeaderIndex = (0, _react.useMemo)(() => childrenArray.findIndex(child => child.type.displayName === _flatTableRowHeader.default.displayName && child.props.stickyAlignment !== "right"), [childrenArray]);
|
|
56
|
-
const rhsRowHeaderIndex = (0, _react.useMemo)(() => childrenArray.findIndex(child => child.type.displayName === _flatTableRowHeader.default.displayName && child.props.stickyAlignment === "right"), [childrenArray]);
|
|
57
|
+
const lhsRowHeaderIndex = (0, _react.useMemo)(() => childrenArray.findIndex(child => /*#__PURE__*/_react.default.isValidElement(child) && child.type.displayName === _flatTableRowHeader.default.displayName && child.props.stickyAlignment !== "right"), [childrenArray]);
|
|
58
|
+
const rhsRowHeaderIndex = (0, _react.useMemo)(() => childrenArray.findIndex(child => /*#__PURE__*/_react.default.isValidElement(child) && child.type.displayName === _flatTableRowHeader.default.displayName && child.props.stickyAlignment === "right"), [childrenArray]);
|
|
57
59
|
const [tabIndex, setTabIndex] = (0, _react.useState)(-1);
|
|
58
60
|
const noStickyColumnsOverlap = (0, _react.useMemo)(() => {
|
|
59
61
|
const hasLhsColumn = lhsRowHeaderIndex !== -1;
|
|
@@ -68,6 +70,9 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
68
70
|
setSelectedId,
|
|
69
71
|
selectedId
|
|
70
72
|
} = (0, _react.useContext)(_flatTable.FlatTableThemeContext);
|
|
73
|
+
const {
|
|
74
|
+
isInSidebar
|
|
75
|
+
} = (0, _react.useContext)(_drawer.DrawerSidebarContext);
|
|
71
76
|
const reportCellWidth = (0, _react.useCallback)((width, index) => {
|
|
72
77
|
const isLeftSticky = index < lhsRowHeaderIndex;
|
|
73
78
|
const copiedArray = isLeftSticky ? leftStickyCellWidths : rightStickyCellWidths;
|
|
@@ -83,7 +88,7 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
83
88
|
}
|
|
84
89
|
}, [lhsRowHeaderIndex, leftStickyCellWidths, rightStickyCellWidths]);
|
|
85
90
|
let interactiveRowProps = {};
|
|
86
|
-
const firstCellIndex = childrenArray[0].type === _flatTableCheckbox.default ? 1 : 0;
|
|
91
|
+
const firstCellIndex = /*#__PURE__*/_react.default.isValidElement(childrenArray[0]) && childrenArray[0].type === _flatTableCheckbox.default ? 1 : 0;
|
|
87
92
|
const toggleExpanded = () => setIsExpanded(!isExpanded);
|
|
88
93
|
function onKeyDown(ev) {
|
|
89
94
|
const isEnterOrSpaceKey = _events.default.isEnterKey(ev) || _events.default.isSpaceKey(ev);
|
|
@@ -139,13 +144,13 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
139
144
|
}, [expanded]);
|
|
140
145
|
(0, _react.useEffect)(() => {
|
|
141
146
|
if (highlighted || selected) {
|
|
142
|
-
setSelectedId(internalId.current);
|
|
147
|
+
setSelectedId(String(internalId.current));
|
|
143
148
|
}
|
|
144
149
|
}, [highlighted, selected, setSelectedId]);
|
|
145
150
|
(0, _react.useEffect)(() => {
|
|
146
151
|
setTabIndex(selectedId === internalId.current ? 0 : -1);
|
|
147
152
|
}, [selectedId]);
|
|
148
|
-
const rowComponent =
|
|
153
|
+
const rowComponent = () => /*#__PURE__*/_react.default.createElement(_flatTableRow.default, _extends({
|
|
149
154
|
isInSidebar: isInSidebar,
|
|
150
155
|
expandable: expandable,
|
|
151
156
|
isSubRow: isSubRow,
|
|
@@ -167,9 +172,9 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
167
172
|
applyBorderLeft: applyBorderLeft,
|
|
168
173
|
draggable: draggable,
|
|
169
174
|
totalChildren: childrenArray.length,
|
|
170
|
-
id: internalId.current
|
|
175
|
+
id: String(internalId.current)
|
|
171
176
|
}, interactiveRowProps, rest), _react.default.Children.map(children, (child, index) => {
|
|
172
|
-
return child && /*#__PURE__*/_react.default.cloneElement(child, {
|
|
177
|
+
return /*#__PURE__*/_react.default.isValidElement(child) && /*#__PURE__*/_react.default.cloneElement(child, {
|
|
173
178
|
expandable: expandable && index === firstCellIndex,
|
|
174
179
|
onClick: expandable && index === firstCellIndex && firstColumnExpandable ? () => toggleExpanded() : undefined,
|
|
175
180
|
onKeyDown: expandable && index === firstCellIndex && firstColumnExpandable ? handleCellKeyDown : undefined,
|
|
@@ -180,70 +185,41 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
180
185
|
...child.props
|
|
181
186
|
});
|
|
182
187
|
}));
|
|
183
|
-
const draggableComponent =
|
|
188
|
+
const draggableComponent = () => /*#__PURE__*/_react.default.createElement(_flatTableRowDraggable.default, {
|
|
184
189
|
id: internalId.current,
|
|
185
190
|
moveItem: moveItem,
|
|
186
191
|
findItem: findItem
|
|
187
|
-
}, rowComponent(
|
|
188
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, draggable ? draggableComponent(isInSidebar) : rowComponent(isInSidebar), isExpanded && subRows && _react.default.Children.map(subRows, (child, index) => child && /*#__PURE__*/_react.default.cloneElement(child, {
|
|
193
|
-
isSubRow: true,
|
|
194
|
-
isFirstSubRow: index === 0,
|
|
192
|
+
}, rowComponent());
|
|
193
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, draggable ? draggableComponent() : rowComponent(), isExpanded && subRows && _react.default.Children.map(subRows, (child, index) => child && /*#__PURE__*/_react.default.cloneElement(child, {
|
|
194
|
+
isSubRow: true,
|
|
195
|
+
isFirstSubRow: index === 0,
|
|
196
|
+
...( /*#__PURE__*/_react.default.isValidElement(child) && {
|
|
195
197
|
...child.props
|
|
196
|
-
})
|
|
197
|
-
});
|
|
198
|
+
})
|
|
199
|
+
})));
|
|
198
200
|
});
|
|
201
|
+
exports.FlatTableRow = FlatTableRow;
|
|
199
202
|
FlatTableRow.propTypes = {
|
|
200
|
-
|
|
201
|
-
bgColor: _propTypes.default.string,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
horizontalBorderColor: _propTypes.default.string,
|
|
220
|
-
/** Sets the weight of the bottom border in the row */
|
|
221
|
-
horizontalBorderSize: _propTypes.default.oneOf(["small", "medium", "large"]),
|
|
222
|
-
/** @ignore @private */
|
|
223
|
-
isSubRow: _propTypes.default.bool,
|
|
224
|
-
/** @ignore @private */
|
|
225
|
-
isFirstSubRow: _propTypes.default.bool,
|
|
226
|
-
/** @ignore @private position in header if multiple rows */
|
|
227
|
-
stickyOffset: _propTypes.default.number,
|
|
228
|
-
/** @ignore @private applies a border-left to the first child */
|
|
229
|
-
applyBorderLeft: _propTypes.default.bool,
|
|
230
|
-
/** ID for use in drag and drop functionality
|
|
231
|
-
* @private
|
|
232
|
-
* @ignore
|
|
233
|
-
*/
|
|
234
|
-
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
235
|
-
/**
|
|
236
|
-
* @private
|
|
237
|
-
* @ignore
|
|
238
|
-
*/
|
|
239
|
-
findItem: _propTypes.default.func,
|
|
240
|
-
/**
|
|
241
|
-
* @private
|
|
242
|
-
* @ignore
|
|
243
|
-
*/
|
|
244
|
-
moveItem: _propTypes.default.func,
|
|
245
|
-
/** @ignore @private position in header if multiple rows */
|
|
246
|
-
draggable: _propTypes.default.bool
|
|
203
|
+
"applyBorderLeft": _propTypes.default.bool,
|
|
204
|
+
"bgColor": _propTypes.default.string,
|
|
205
|
+
"children": _propTypes.default.node,
|
|
206
|
+
"draggable": _propTypes.default.bool,
|
|
207
|
+
"expandable": _propTypes.default.bool,
|
|
208
|
+
"expandableArea": _propTypes.default.oneOf(["firstColumn", "wholeRow"]),
|
|
209
|
+
"expanded": _propTypes.default.bool,
|
|
210
|
+
"findItem": _propTypes.default.func,
|
|
211
|
+
"highlighted": _propTypes.default.bool,
|
|
212
|
+
"horizontalBorderColor": _propTypes.default.string,
|
|
213
|
+
"horizontalBorderSize": _propTypes.default.oneOf(["large", "medium", "small"]),
|
|
214
|
+
"id": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
215
|
+
"isFirstSubRow": _propTypes.default.bool,
|
|
216
|
+
"isSubRow": _propTypes.default.bool,
|
|
217
|
+
"moveItem": _propTypes.default.func,
|
|
218
|
+
"onClick": _propTypes.default.func,
|
|
219
|
+
"selected": _propTypes.default.bool,
|
|
220
|
+
"stickyOffset": _propTypes.default.number,
|
|
221
|
+
"subRows": _propTypes.default.node
|
|
247
222
|
};
|
|
223
|
+
FlatTableRow.displayName = "FlatTableRow";
|
|
248
224
|
var _default = FlatTableRow;
|
|
249
225
|
exports.default = _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FlatTableProps } from "..";
|
|
2
|
+
import { FlatTableRowProps } from "./flat-table-row.component";
|
|
3
|
+
interface StyledFlatTableRowProps extends Pick<FlatTableRowProps, "bgColor" | "horizontalBorderColor" | "stickyOffset" | "expandable" | "selected" | "highlighted" | "isSubRow" | "isFirstSubRow" | "applyBorderLeft" | "draggable"> {
|
|
4
|
+
isRowInteractive?: boolean;
|
|
5
|
+
isFirstColumnInteractive?: boolean;
|
|
6
|
+
lhsRowHeaderIndex: number;
|
|
7
|
+
rhsRowHeaderIndex: number;
|
|
8
|
+
totalChildren: number;
|
|
9
|
+
firstCellIndex: number;
|
|
10
|
+
colorTheme: FlatTableProps["colorTheme"];
|
|
11
|
+
isExpanded?: boolean;
|
|
12
|
+
isInSidebar?: boolean;
|
|
13
|
+
size: FlatTableProps["size"];
|
|
14
|
+
isDragging?: boolean;
|
|
15
|
+
horizontalBorderSize: NonNullable<FlatTableRowProps["horizontalBorderSize"]>;
|
|
16
|
+
}
|
|
17
|
+
declare const StyledFlatTableRow: import("styled-components").StyledComponent<"tr", any, StyledFlatTableRowProps, never>;
|
|
18
|
+
export default StyledFlatTableRow;
|
|
@@ -170,7 +170,7 @@ const StyledFlatTableRow = _styledComponents.default.tr`
|
|
|
170
170
|
`}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
${stickyOffset > 0 && (0, _styledComponents.css)`
|
|
173
|
+
${stickyOffset !== undefined && stickyOffset > 0 && (0, _styledComponents.css)`
|
|
174
174
|
&& th {
|
|
175
175
|
top: ${stickyOffset}px;
|
|
176
176
|
}
|
|
@@ -388,8 +388,7 @@ const StyledFlatTableRow = _styledComponents.default.tr`
|
|
|
388
388
|
}}
|
|
389
389
|
`;
|
|
390
390
|
StyledFlatTableRow.defaultProps = {
|
|
391
|
-
theme: _themes.baseTheme
|
|
392
|
-
horizontalBorderSize: "small"
|
|
391
|
+
theme: _themes.baseTheme
|
|
393
392
|
};
|
|
394
393
|
var _default = StyledFlatTableRow;
|
|
395
394
|
exports.default = _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./flat-table-row";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./flat-table-row.component";
|
|
2
|
+
export type { FlatTableRowProps } from "./flat-table-row.component";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
|
+
export interface FlatTableRowHeaderProps extends PaddingProps {
|
|
5
|
+
/** Content alignment */
|
|
6
|
+
align?: TableCellAlign;
|
|
7
|
+
/** RowHeader content */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Column width, pass a number to set a fixed width in pixels */
|
|
10
|
+
width?: number;
|
|
11
|
+
/** Truncate cell content and add ellipsis to any text that overflows */
|
|
12
|
+
truncate?: boolean;
|
|
13
|
+
/** Title text to display if cell content truncates */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** Sets a custom vertical right border */
|
|
16
|
+
verticalBorder?: TableBorderSize;
|
|
17
|
+
/** Sets the color of the right border */
|
|
18
|
+
verticalBorderColor?: string;
|
|
19
|
+
/** Defines whether the column should be sticky on the left or right hand side of the Table */
|
|
20
|
+
stickyAlignment?: "left" | "right";
|
|
21
|
+
/** Number of columns that a header cell should span */
|
|
22
|
+
colspan?: number | string;
|
|
23
|
+
/** Number of rows that a header cell should span */
|
|
24
|
+
rowspan?: number | string;
|
|
25
|
+
/** Sets an id string on the DOM element */
|
|
26
|
+
id?: string;
|
|
27
|
+
/**
|
|
28
|
+
* @private
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
expandable?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @private
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
onKeyDown?: (ev: React.KeyboardEvent<HTMLElement>) => void;
|
|
42
|
+
/**
|
|
43
|
+
* @private
|
|
44
|
+
* @ignore
|
|
45
|
+
* Sets the left position when sticky column found
|
|
46
|
+
*/
|
|
47
|
+
leftPosition?: number;
|
|
48
|
+
/**
|
|
49
|
+
* @private
|
|
50
|
+
* @ignore
|
|
51
|
+
* Sets the right position when sticky column found
|
|
52
|
+
*/
|
|
53
|
+
rightPosition?: number;
|
|
54
|
+
/**
|
|
55
|
+
* @private
|
|
56
|
+
* @ignore
|
|
57
|
+
* Index of cell within row
|
|
58
|
+
*/
|
|
59
|
+
cellIndex?: number;
|
|
60
|
+
/**
|
|
61
|
+
* @private
|
|
62
|
+
* @ignore
|
|
63
|
+
* Callback to report the offsetWidth
|
|
64
|
+
*/
|
|
65
|
+
reportCellWidth?: (offset: number, index?: number) => void;
|
|
66
|
+
}
|
|
67
|
+
export declare const FlatTableRowHeader: {
|
|
68
|
+
({ align, children, width, py, px, expandable, onClick, onKeyDown, leftPosition, rightPosition, truncate, title, stickyAlignment, colspan, rowspan, ...rest }: FlatTableRowHeaderProps): React.JSX.Element;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
export default FlatTableRowHeader;
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.FlatTableRowHeader = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
10
|
-
var _utils = require("../../../style/utils");
|
|
11
9
|
var _icon = _interopRequireDefault(require("../../icon"));
|
|
12
10
|
var _flatTableRowHeader = require("./flat-table-row-header.style");
|
|
13
11
|
var _flatTable = require("../flat-table.component");
|
|
@@ -16,7 +14,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
-
const paddingPropTypes = (0, _utils.filterStyledSystemPaddingProps)(_propTypes2.default.space);
|
|
20
17
|
const FlatTableRowHeader = _ref => {
|
|
21
18
|
let {
|
|
22
19
|
align = "left",
|
|
@@ -32,6 +29,8 @@ const FlatTableRowHeader = _ref => {
|
|
|
32
29
|
truncate,
|
|
33
30
|
title,
|
|
34
31
|
stickyAlignment = "left",
|
|
32
|
+
colspan,
|
|
33
|
+
rowspan,
|
|
35
34
|
...rest
|
|
36
35
|
} = _ref;
|
|
37
36
|
const id = (0, _react.useRef)((0, _guid.default)());
|
|
@@ -53,16 +52,20 @@ const FlatTableRowHeader = _ref => {
|
|
|
53
52
|
rightPosition: stickyAlignment === "right" ? rightPosition || 0 : undefined,
|
|
54
53
|
align: align,
|
|
55
54
|
"data-element": "flat-table-row-header",
|
|
56
|
-
|
|
55
|
+
width: width,
|
|
57
56
|
py: py || "10px",
|
|
58
57
|
px: px || 3,
|
|
59
58
|
onClick: handleOnClick,
|
|
60
59
|
tabIndex: expandable && onClick ? tabIndex : undefined,
|
|
61
60
|
onKeyDown: handleOnKeyDown,
|
|
62
|
-
|
|
61
|
+
truncate: truncate,
|
|
63
62
|
expandable: expandable,
|
|
64
63
|
stickyAlignment: stickyAlignment,
|
|
65
64
|
id: id.current
|
|
65
|
+
}, colspan !== undefined && {
|
|
66
|
+
colSpan: Number(colspan)
|
|
67
|
+
}, rowspan !== undefined && {
|
|
68
|
+
rowSpan: Number(rowspan)
|
|
66
69
|
}, rest), /*#__PURE__*/_react.default.createElement(_flatTableRowHeader.StyledFlatTableRowHeaderContent, {
|
|
67
70
|
title: truncate && !title && typeof children === "string" ? children : title,
|
|
68
71
|
expandable: expandable
|
|
@@ -72,51 +75,7 @@ const FlatTableRowHeader = _ref => {
|
|
|
72
75
|
mr: "8px"
|
|
73
76
|
}), children));
|
|
74
77
|
};
|
|
75
|
-
FlatTableRowHeader
|
|
76
|
-
/** Styled system padding props */
|
|
77
|
-
...paddingPropTypes,
|
|
78
|
-
/** Content alignment */
|
|
79
|
-
align: _propTypes.default.oneOf(["center", "left", "right"]),
|
|
80
|
-
/** RowHeader content */
|
|
81
|
-
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string]),
|
|
82
|
-
/** Column width, pass a number to set a fixed width in pixels */
|
|
83
|
-
width: _propTypes.default.number,
|
|
84
|
-
/** Truncate cell content and add ellipsis to any text that overflows */
|
|
85
|
-
truncate: _propTypes.default.bool,
|
|
86
|
-
/** Title text to display if cell content truncates */
|
|
87
|
-
title: _propTypes.default.string,
|
|
88
|
-
/**
|
|
89
|
-
* @private
|
|
90
|
-
* @ignore
|
|
91
|
-
*/
|
|
92
|
-
expandable: _propTypes.default.bool,
|
|
93
|
-
/**
|
|
94
|
-
* @private
|
|
95
|
-
* @ignore
|
|
96
|
-
*/
|
|
97
|
-
onClick: _propTypes.default.func,
|
|
98
|
-
/**
|
|
99
|
-
* @private
|
|
100
|
-
* @ignore
|
|
101
|
-
*/
|
|
102
|
-
onKeyDown: _propTypes.default.func,
|
|
103
|
-
/** Sets a custom vertical right border */
|
|
104
|
-
verticalBorder: _propTypes.default.oneOf(["small", "medium", "large"]),
|
|
105
|
-
/** Sets a vertical right border color, provide design token, any color from palette or any valid css color value. */
|
|
106
|
-
verticalBorderColor: _propTypes.default.string,
|
|
107
|
-
/** Defines whether the column should be sticky on the left or right hand side of the Table */
|
|
108
|
-
stickyAlignment: _propTypes.default.oneOf(["left", "right"]),
|
|
109
|
-
/**
|
|
110
|
-
* @private
|
|
111
|
-
* @ignore
|
|
112
|
-
*/
|
|
113
|
-
leftPosition: _propTypes.default.number,
|
|
114
|
-
/**
|
|
115
|
-
* @private
|
|
116
|
-
* @ignore
|
|
117
|
-
*/
|
|
118
|
-
rightPosition: _propTypes.default.number
|
|
119
|
-
};
|
|
78
|
+
exports.FlatTableRowHeader = FlatTableRowHeader;
|
|
120
79
|
FlatTableRowHeader.displayName = "FlatTableRowHeader";
|
|
121
80
|
var _default = FlatTableRowHeader;
|
|
122
81
|
exports.default = _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FlatTableRowHeaderProps } from "./flat-table-row-header.component";
|
|
2
|
+
declare const StyledFlatTableRowHeader: import("styled-components").StyledComponent<"th", any, FlatTableRowHeaderProps, never>;
|
|
3
|
+
declare const StyledFlatTableRowHeaderContent: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
expandable?: boolean | undefined;
|
|
5
|
+
}, never>;
|
|
6
|
+
export { StyledFlatTableRowHeader, StyledFlatTableRowHeaderContent };
|
|
@@ -21,10 +21,10 @@ const StyledFlatTableRowHeader = _styledComponents.default.th`
|
|
|
21
21
|
let {
|
|
22
22
|
align,
|
|
23
23
|
theme,
|
|
24
|
-
|
|
24
|
+
width,
|
|
25
25
|
leftPosition,
|
|
26
26
|
rightPosition,
|
|
27
|
-
|
|
27
|
+
truncate,
|
|
28
28
|
expandable,
|
|
29
29
|
verticalBorder,
|
|
30
30
|
verticalBorderColor,
|
|
@@ -44,22 +44,22 @@ const StyledFlatTableRowHeader = _styledComponents.default.th`
|
|
|
44
44
|
padding: 0;
|
|
45
45
|
z-index: ${_base.default.zIndex.overlay};
|
|
46
46
|
|
|
47
|
-
${
|
|
48
|
-
width: ${
|
|
47
|
+
${width && (0, _styledComponents.css)`
|
|
48
|
+
width: ${width}px;
|
|
49
49
|
`}
|
|
50
50
|
|
|
51
51
|
&&&& {
|
|
52
52
|
> div {
|
|
53
53
|
box-sizing: border-box;
|
|
54
54
|
|
|
55
|
-
${
|
|
55
|
+
${truncate && (0, _styledComponents.css)`
|
|
56
56
|
text-overflow: ellipsis;
|
|
57
57
|
overflow: hidden;
|
|
58
58
|
white-space: nowrap;
|
|
59
59
|
`}
|
|
60
60
|
|
|
61
|
-
${
|
|
62
|
-
width: ${
|
|
61
|
+
${width && (0, _styledComponents.css)`
|
|
62
|
+
width: ${width}px;
|
|
63
63
|
`}
|
|
64
64
|
|
|
65
65
|
${_styledSystem.padding}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./flat-table-row-header";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./flat-table-row-header.component";
|
|
2
|
+
export type { FlatTableRowHeaderProps } from "./flat-table-row-header.component";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
export interface FlatTableProps extends MarginProps {
|
|
4
|
+
/** The HTML id of the element that contains a description of this table. */
|
|
5
|
+
ariaDescribedby?: string;
|
|
6
|
+
/** A string to render as the table's caption */
|
|
7
|
+
caption?: string;
|
|
8
|
+
/** FlatTableHead and FlatTableBody */
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/** `FlatTable` color theme */
|
|
11
|
+
colorTheme?: "light" | "transparent-base" | "transparent-white" | "dark";
|
|
12
|
+
/** Content to be rendered at the foot of the table */
|
|
13
|
+
footer?: React.ReactNode;
|
|
14
|
+
/** If true, the header does not scroll with the content */
|
|
15
|
+
hasStickyFooter?: boolean;
|
|
16
|
+
/** If true, the header does not scroll with the content */
|
|
17
|
+
hasStickyHead?: boolean;
|
|
18
|
+
/** Set the height of the table. String can be any valid CSS string, numbers will be converted to pixels. */
|
|
19
|
+
height?: string | number;
|
|
20
|
+
/** Set the min-height of the table. String can be any valid CSS string, numbers will be converted to pixels. */
|
|
21
|
+
minHeight?: string | number;
|
|
22
|
+
/** Toggles the zebra striping for the table rows */
|
|
23
|
+
isZebra?: boolean;
|
|
24
|
+
/** Used to define the tables size Renders as: 'compact', 'small', 'medium', 'large' and 'extraLarge' */
|
|
25
|
+
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
26
|
+
/** Applies max-height of 100% to FlatTable if true */
|
|
27
|
+
hasMaxHeight?: boolean;
|
|
28
|
+
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
29
|
+
overflowX?: string;
|
|
30
|
+
/** Width of the table. Any valid CSS string */
|
|
31
|
+
width?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FlatTableThemeContextProps extends Pick<FlatTableProps, "colorTheme" | "size"> {
|
|
34
|
+
selectedId?: string;
|
|
35
|
+
setSelectedId: (id: string) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare const FlatTableThemeContext: React.Context<FlatTableThemeContextProps>;
|
|
38
|
+
export declare const FlatTable: {
|
|
39
|
+
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
export default FlatTable;
|