@atlaskit/table-tree 9.5.0 → 9.6.1
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/CHANGELOG.md +12 -0
- package/dist/cjs/components/cell.js +13 -8
- package/dist/cjs/components/header.js +11 -7
- package/dist/cjs/components/headers.js +17 -13
- package/dist/cjs/components/internal/items.js +1 -4
- package/dist/cjs/components/internal/styled.js +5 -5
- package/dist/cjs/components/internal/with-column-width.js +23 -49
- package/dist/cjs/components/row.js +2 -2
- package/dist/cjs/components/table-tree.js +21 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/cell.js +13 -8
- package/dist/es2019/components/header.js +11 -7
- package/dist/es2019/components/headers.js +14 -10
- package/dist/es2019/components/internal/items.js +1 -4
- package/dist/es2019/components/internal/styled.js +5 -5
- package/dist/es2019/components/internal/with-column-width.js +27 -29
- package/dist/es2019/components/row.js +2 -2
- package/dist/es2019/components/table-tree.js +18 -17
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/cell.js +13 -8
- package/dist/esm/components/header.js +11 -7
- package/dist/esm/components/headers.js +17 -13
- package/dist/esm/components/internal/items.js +1 -4
- package/dist/esm/components/internal/styled.js +5 -5
- package/dist/esm/components/internal/with-column-width.js +24 -51
- package/dist/esm/components/row.js +2 -2
- package/dist/esm/components/table-tree.js +19 -18
- package/dist/esm/version.json +1 -1
- package/dist/types/components/cell.d.ts +6 -59
- package/dist/types/components/header.d.ts +1 -58
- package/dist/types/components/internal/with-column-width.d.ts +2 -60
- package/dist/types/components/table-tree.d.ts +15 -15
- package/dist/types-ts4.5/components/cell.d.ts +6 -59
- package/dist/types-ts4.5/components/header.d.ts +1 -58
- package/dist/types-ts4.5/components/internal/with-column-width.d.ts +2 -60
- package/dist/types-ts4.5/components/table-tree.d.ts +15 -15
- package/package.json +19 -22
- package/report.api.md +9 -268
- package/tmp/api-report-tmp.d.ts +109 -0
|
@@ -30,14 +30,19 @@ var Cell = /*#__PURE__*/function (_Component) {
|
|
|
30
30
|
width = _this$props.width,
|
|
31
31
|
className = _this$props.className,
|
|
32
32
|
props = _objectWithoutProperties(_this$props, _excluded);
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
return (
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
// TODO: Determine whether proper `td` elements can be used instead of
|
|
36
|
+
// roles (DSP-11588)
|
|
37
|
+
React.createElement(CommonCell, _extends({
|
|
38
|
+
role: "gridcell",
|
|
39
|
+
indent: indentLevel ? "calc(".concat(indentBase, " * ").concat(indentLevel, ")") : undefined,
|
|
40
|
+
width: width,
|
|
41
|
+
className: className
|
|
42
|
+
}, props), /*#__PURE__*/React.createElement(OverflowContainer, {
|
|
43
|
+
isSingleLine: singleLine
|
|
44
|
+
}, children))
|
|
45
|
+
);
|
|
41
46
|
}
|
|
42
47
|
}]);
|
|
43
48
|
return Cell;
|
|
@@ -30,13 +30,17 @@ var Header = /*#__PURE__*/function (_Component) {
|
|
|
30
30
|
key: "render",
|
|
31
31
|
value: function render() {
|
|
32
32
|
var props = this.props;
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
return (
|
|
34
|
+
// TODO: Determine whether proper `th` elements can be used instead of
|
|
35
|
+
// roles (DSP-11588)
|
|
36
|
+
jsx(ColumnCell, _extends({
|
|
37
|
+
css: headerStyles,
|
|
38
|
+
role: "columnheader",
|
|
39
|
+
style: {
|
|
40
|
+
width: props.width
|
|
41
|
+
}
|
|
42
|
+
}, props), props.children)
|
|
43
|
+
);
|
|
40
44
|
}
|
|
41
45
|
}]);
|
|
42
46
|
return Header;
|
|
@@ -23,19 +23,23 @@ var Headers = /*#__PURE__*/function (_Component) {
|
|
|
23
23
|
_createClass(Headers, [{
|
|
24
24
|
key: "render",
|
|
25
25
|
value: function render() {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
return (
|
|
27
|
+
// TODO: Determine whether proper `tr` elements can be used instead of
|
|
28
|
+
// roles (DSP-11588)
|
|
29
|
+
jsx("div", {
|
|
30
|
+
css: containerStyles,
|
|
31
|
+
role: "row"
|
|
32
|
+
}, Children.map(this.props.children, function (header, index) {
|
|
33
|
+
return (
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
36
|
+
cloneElement(header, {
|
|
37
|
+
key: index,
|
|
38
|
+
columnIndex: index
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
}))
|
|
42
|
+
);
|
|
39
43
|
}
|
|
40
44
|
}]);
|
|
41
45
|
return Headers;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
3
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -69,9 +68,7 @@ var Items = /*#__PURE__*/function (_Component) {
|
|
|
69
68
|
'aria-busy': true,
|
|
70
69
|
'aria-live': 'polite'
|
|
71
70
|
} : {};
|
|
72
|
-
return /*#__PURE__*/React.createElement("div",
|
|
73
|
-
role: "rowgroup"
|
|
74
|
-
}, busyAttrs), isLoaderShown ? this.renderLoader() : this.renderItems());
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", busyAttrs, isLoaderShown ? this.renderLoader() : this.renderItems());
|
|
75
72
|
}
|
|
76
73
|
}], [{
|
|
77
74
|
key: "getDerivedStateFromProps",
|
|
@@ -25,10 +25,10 @@ export var TreeRowContainer = function TreeRowContainer(props) {
|
|
|
25
25
|
};
|
|
26
26
|
var commonChevronContainerStyles = css({
|
|
27
27
|
display: 'flex',
|
|
28
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
29
29
|
marginLeft: "calc(".concat(indentBase, " * -1)"),
|
|
30
30
|
position: 'absolute',
|
|
31
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
31
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
32
32
|
top: 7,
|
|
33
33
|
alignItems: 'center'
|
|
34
34
|
});
|
|
@@ -46,7 +46,7 @@ export var ChevronContainer = function ChevronContainer(props
|
|
|
46
46
|
};
|
|
47
47
|
var chevronIconContainerStyles = css({
|
|
48
48
|
position: 'relative',
|
|
49
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
49
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
50
50
|
top: 1
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -64,11 +64,11 @@ export var ChevronIconContainer = function ChevronIconContainer(props
|
|
|
64
64
|
};
|
|
65
65
|
var loadingItemContainerStyles = css({
|
|
66
66
|
width: '100%',
|
|
67
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
67
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
68
68
|
paddingTop: 5
|
|
69
69
|
});
|
|
70
70
|
var paddingLeftStyles = css({
|
|
71
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
71
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
72
72
|
paddingLeft: '50%'
|
|
73
73
|
});
|
|
74
74
|
/**
|
|
@@ -1,58 +1,31 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
3
|
var _excluded = ["width", "columnIndex"];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/* eslint-disable react/prop-types */
|
|
13
|
-
import React, { Component } from 'react';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useContext, useEffect } from 'react';
|
|
5
|
+
import { TableTreeContext } from '../table-tree';
|
|
15
6
|
export default function withColumnWidth(Cell) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
value: function UNSAFE_componentWillMount() {
|
|
27
|
-
this.setColumnWidth(this.props.width);
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "setColumnWidth",
|
|
31
|
-
value: function setColumnWidth(width) {
|
|
32
|
-
if (width !== undefined) {
|
|
33
|
-
this.context.tableTree.setColumnWidth(this.props.columnIndex, width);
|
|
34
|
-
}
|
|
7
|
+
return function (props) {
|
|
8
|
+
var _useContext = useContext(TableTreeContext),
|
|
9
|
+
setColumnWidth = _useContext.setColumnWidth,
|
|
10
|
+
getColumnWidth = _useContext.getColumnWidth;
|
|
11
|
+
var width = props.width,
|
|
12
|
+
columnIndex = props.columnIndex,
|
|
13
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
if (width !== undefined && columnIndex !== undefined) {
|
|
16
|
+
setColumnWidth(columnIndex, width);
|
|
35
17
|
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
}, [width, columnIndex, setColumnWidth]);
|
|
19
|
+
var columnWidth;
|
|
20
|
+
if (width !== null && width !== undefined) {
|
|
21
|
+
columnWidth = width;
|
|
22
|
+
} else {
|
|
23
|
+
if (columnIndex !== undefined) {
|
|
24
|
+
columnWidth = getColumnWidth(columnIndex);
|
|
40
25
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
columnIndex = _this$props.columnIndex,
|
|
47
|
-
other = _objectWithoutProperties(_this$props, _excluded);
|
|
48
|
-
var columnWidth = width !== null && width !== undefined ? width : this.context.tableTree.getColumnWidth(columnIndex);
|
|
49
|
-
return /*#__PURE__*/React.createElement(Cell, _extends({
|
|
50
|
-
width: columnWidth
|
|
51
|
-
}, other));
|
|
52
|
-
}
|
|
53
|
-
}]);
|
|
54
|
-
return CellWithColumnWidth;
|
|
55
|
-
}(Component), _defineProperty(_class, "contextTypes", {
|
|
56
|
-
tableTree: PropTypes.object.isRequired
|
|
57
|
-
}), _class;
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(Cell, _extends({
|
|
28
|
+
width: columnWidth
|
|
29
|
+
}, other));
|
|
30
|
+
};
|
|
58
31
|
}
|
|
@@ -20,7 +20,7 @@ var treeRowClickableStyles = css({
|
|
|
20
20
|
cursor: 'pointer'
|
|
21
21
|
});
|
|
22
22
|
var packageName = "@atlaskit/table-tree";
|
|
23
|
-
var packageVersion = "9.
|
|
23
|
+
var packageVersion = "9.6.1";
|
|
24
24
|
var Row = /*#__PURE__*/function (_Component) {
|
|
25
25
|
_inherits(Row, _Component);
|
|
26
26
|
var _super = _createSuper(Row);
|
|
@@ -120,7 +120,7 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
120
120
|
extendedLabel: extendedLabel,
|
|
121
121
|
isExpanded: isExpanded,
|
|
122
122
|
onExpandToggle: this.onExpandToggle,
|
|
123
|
-
ariaControls: toItemId(props.itemId),
|
|
123
|
+
ariaControls: isExpanded ? toItemId(props.itemId) : undefined,
|
|
124
124
|
rowId: props.itemId
|
|
125
125
|
})].concat(cellContent);
|
|
126
126
|
}
|
|
@@ -8,13 +8,23 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
10
|
/* eslint-disable react/prop-types */
|
|
11
|
-
import React, { Component } from 'react';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
11
|
+
import React, { Component, createContext } from 'react';
|
|
13
12
|
import Cell from './cell';
|
|
14
13
|
import Header from './header';
|
|
15
14
|
import Headers from './headers';
|
|
16
15
|
import Row from './row';
|
|
17
16
|
import Rows from './rows';
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Context provider which maintains the column widths and access methods for use in descendent table cells
|
|
20
|
+
* Enables composed table-tree implementations to e.g. set width on header cells only
|
|
21
|
+
*/
|
|
22
|
+
export var TableTreeContext = /*#__PURE__*/createContext({
|
|
23
|
+
setColumnWidth: function setColumnWidth() {},
|
|
24
|
+
getColumnWidth: function getColumnWidth() {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
18
28
|
var TableTree = /*#__PURE__*/function (_Component) {
|
|
19
29
|
_inherits(TableTree, _Component);
|
|
20
30
|
var _super = _createSuper(TableTree);
|
|
@@ -53,17 +63,6 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
53
63
|
}); // eslint-disable-line
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "getChildContext",
|
|
58
|
-
value: function getChildContext() {
|
|
59
|
-
return {
|
|
60
|
-
tableTree: {
|
|
61
|
-
columnWidths: this.state.columnWidths,
|
|
62
|
-
setColumnWidth: this.setColumnWidth,
|
|
63
|
-
getColumnWidth: this.getColumnWidth
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
66
|
}, {
|
|
68
67
|
key: "render",
|
|
69
68
|
value: function render() {
|
|
@@ -113,15 +112,17 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
113
112
|
}
|
|
114
113
|
});
|
|
115
114
|
}
|
|
116
|
-
return /*#__PURE__*/React.createElement(
|
|
115
|
+
return /*#__PURE__*/React.createElement(TableTreeContext.Provider, {
|
|
116
|
+
value: {
|
|
117
|
+
setColumnWidth: this.setColumnWidth,
|
|
118
|
+
getColumnWidth: this.getColumnWidth
|
|
119
|
+
}
|
|
120
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
117
121
|
role: "treegrid",
|
|
118
122
|
"aria-readonly": true
|
|
119
|
-
}, heads, rows, this.props.children);
|
|
123
|
+
}, heads, rows, this.props.children));
|
|
120
124
|
}
|
|
121
125
|
}]);
|
|
122
126
|
return TableTree;
|
|
123
127
|
}(Component);
|
|
124
|
-
_defineProperty(TableTree, "childContextTypes", {
|
|
125
|
-
tableTree: PropTypes.object.isRequired
|
|
126
|
-
});
|
|
127
128
|
export { TableTree as default };
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export interface CellProps {
|
|
3
3
|
/**
|
|
4
4
|
* Whether the cell contents should wrap or display on a single line and be concatenated.
|
|
@@ -16,63 +16,10 @@ export interface CellProps {
|
|
|
16
16
|
* Class name to apply to cell.
|
|
17
17
|
*/
|
|
18
18
|
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Children content, used when composing table-tree from internal components
|
|
21
|
+
*/
|
|
22
|
+
children?: ReactNode;
|
|
19
23
|
}
|
|
20
|
-
declare const _default:
|
|
21
|
-
new (props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>): {
|
|
22
|
-
UNSAFE_componentWillMount(): void;
|
|
23
|
-
setColumnWidth(width?: string | number | undefined): void;
|
|
24
|
-
UNSAFE_componentWillReceiveProps(nextProps: import("./internal/with-column-width").CellWithColumnWidthProps): void;
|
|
25
|
-
render(): JSX.Element;
|
|
26
|
-
context: any;
|
|
27
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
28
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
29
|
-
readonly props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps> & Readonly<{
|
|
30
|
-
children?: React.ReactNode;
|
|
31
|
-
}>;
|
|
32
|
-
state: Readonly<{}>;
|
|
33
|
-
refs: {
|
|
34
|
-
[key: string]: React.ReactInstance;
|
|
35
|
-
};
|
|
36
|
-
componentDidMount?(): void;
|
|
37
|
-
shouldComponentUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
38
|
-
componentWillUnmount?(): void;
|
|
39
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
40
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>): any;
|
|
41
|
-
componentDidUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
42
|
-
componentWillMount?(): void;
|
|
43
|
-
componentWillReceiveProps?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextContext: any): void;
|
|
44
|
-
componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
45
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
46
|
-
};
|
|
47
|
-
new (props: CellProps & import("./internal/with-column-width").CellWithColumnWidthProps, context?: any): {
|
|
48
|
-
UNSAFE_componentWillMount(): void;
|
|
49
|
-
setColumnWidth(width?: string | number | undefined): void;
|
|
50
|
-
UNSAFE_componentWillReceiveProps(nextProps: import("./internal/with-column-width").CellWithColumnWidthProps): void;
|
|
51
|
-
render(): JSX.Element;
|
|
52
|
-
context: any;
|
|
53
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
54
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
55
|
-
readonly props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps> & Readonly<{
|
|
56
|
-
children?: React.ReactNode;
|
|
57
|
-
}>;
|
|
58
|
-
state: Readonly<{}>;
|
|
59
|
-
refs: {
|
|
60
|
-
[key: string]: React.ReactInstance;
|
|
61
|
-
};
|
|
62
|
-
componentDidMount?(): void;
|
|
63
|
-
shouldComponentUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
64
|
-
componentWillUnmount?(): void;
|
|
65
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
66
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>): any;
|
|
67
|
-
componentDidUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
68
|
-
componentWillMount?(): void;
|
|
69
|
-
componentWillReceiveProps?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextContext: any): void;
|
|
70
|
-
componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
71
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
72
|
-
};
|
|
73
|
-
contextTypes: {
|
|
74
|
-
tableTree: import("prop-types").Validator<object>;
|
|
75
|
-
};
|
|
76
|
-
contextType?: React.Context<any> | undefined;
|
|
77
|
-
};
|
|
24
|
+
declare const _default: (props: CellProps & import("./internal/with-column-width").CellWithColumnWidthProps) => JSX.Element;
|
|
78
25
|
export default _default;
|
|
@@ -1,60 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default:
|
|
3
|
-
new (props: Readonly<any>): {
|
|
4
|
-
UNSAFE_componentWillMount(): void;
|
|
5
|
-
setColumnWidth(width?: string | number | undefined): void;
|
|
6
|
-
UNSAFE_componentWillReceiveProps(nextProps: import("./internal/with-column-width").CellWithColumnWidthProps): void;
|
|
7
|
-
render(): JSX.Element;
|
|
8
|
-
context: any;
|
|
9
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<any>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
10
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
11
|
-
readonly props: Readonly<any> & Readonly<{
|
|
12
|
-
children?: import("react").ReactNode;
|
|
13
|
-
}>;
|
|
14
|
-
state: Readonly<{}>;
|
|
15
|
-
refs: {
|
|
16
|
-
[key: string]: import("react").ReactInstance;
|
|
17
|
-
};
|
|
18
|
-
componentDidMount?(): void;
|
|
19
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
20
|
-
componentWillUnmount?(): void;
|
|
21
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
22
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>): any;
|
|
23
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
24
|
-
componentWillMount?(): void;
|
|
25
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
26
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void;
|
|
27
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void;
|
|
28
|
-
};
|
|
29
|
-
new (props: any, context?: any): {
|
|
30
|
-
UNSAFE_componentWillMount(): void;
|
|
31
|
-
setColumnWidth(width?: string | number | undefined): void;
|
|
32
|
-
UNSAFE_componentWillReceiveProps(nextProps: import("./internal/with-column-width").CellWithColumnWidthProps): void;
|
|
33
|
-
render(): JSX.Element;
|
|
34
|
-
context: any;
|
|
35
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<any>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
36
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
37
|
-
readonly props: Readonly<any> & Readonly<{
|
|
38
|
-
children?: import("react").ReactNode;
|
|
39
|
-
}>;
|
|
40
|
-
state: Readonly<{}>;
|
|
41
|
-
refs: {
|
|
42
|
-
[key: string]: import("react").ReactInstance;
|
|
43
|
-
};
|
|
44
|
-
componentDidMount?(): void;
|
|
45
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
46
|
-
componentWillUnmount?(): void;
|
|
47
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
48
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>): any;
|
|
49
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
50
|
-
componentWillMount?(): void;
|
|
51
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
52
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void;
|
|
53
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void;
|
|
54
|
-
};
|
|
55
|
-
contextTypes: {
|
|
56
|
-
tableTree: import("prop-types").Validator<object>;
|
|
57
|
-
};
|
|
58
|
-
contextType?: import("react").Context<any> | undefined;
|
|
59
|
-
};
|
|
2
|
+
declare const _default: (props: any) => JSX.Element;
|
|
60
3
|
export default _default;
|
|
@@ -1,64 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
export interface CellWithColumnWidthProps {
|
|
4
|
-
width?:
|
|
3
|
+
width?: string | number;
|
|
5
4
|
columnIndex?: number;
|
|
6
5
|
}
|
|
7
|
-
export default function withColumnWidth<T extends object>(Cell: React.ComponentType<T>):
|
|
8
|
-
new (props: Readonly<T & CellWithColumnWidthProps>): {
|
|
9
|
-
UNSAFE_componentWillMount(): void;
|
|
10
|
-
setColumnWidth(width?: number | string): void;
|
|
11
|
-
UNSAFE_componentWillReceiveProps(nextProps: CellWithColumnWidthProps): void;
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
context: any;
|
|
14
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<T & CellWithColumnWidthProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
15
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
16
|
-
readonly props: Readonly<T & CellWithColumnWidthProps> & Readonly<{
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
}>;
|
|
19
|
-
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: React.ReactInstance;
|
|
22
|
-
};
|
|
23
|
-
componentDidMount?(): void;
|
|
24
|
-
shouldComponentUpdate?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
25
|
-
componentWillUnmount?(): void;
|
|
26
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
27
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<T & CellWithColumnWidthProps>, prevState: Readonly<{}>): any;
|
|
28
|
-
componentDidUpdate?(prevProps: Readonly<T & CellWithColumnWidthProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
29
|
-
componentWillMount?(): void;
|
|
30
|
-
componentWillReceiveProps?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
new (props: T & CellWithColumnWidthProps, context?: any): {
|
|
35
|
-
UNSAFE_componentWillMount(): void;
|
|
36
|
-
setColumnWidth(width?: number | string): void;
|
|
37
|
-
UNSAFE_componentWillReceiveProps(nextProps: CellWithColumnWidthProps): void;
|
|
38
|
-
render(): JSX.Element;
|
|
39
|
-
context: any;
|
|
40
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<T & CellWithColumnWidthProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
41
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
42
|
-
readonly props: Readonly<T & CellWithColumnWidthProps> & Readonly<{
|
|
43
|
-
children?: React.ReactNode;
|
|
44
|
-
}>;
|
|
45
|
-
state: Readonly<{}>;
|
|
46
|
-
refs: {
|
|
47
|
-
[key: string]: React.ReactInstance;
|
|
48
|
-
};
|
|
49
|
-
componentDidMount?(): void;
|
|
50
|
-
shouldComponentUpdate?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
51
|
-
componentWillUnmount?(): void;
|
|
52
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
53
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<T & CellWithColumnWidthProps>, prevState: Readonly<{}>): any;
|
|
54
|
-
componentDidUpdate?(prevProps: Readonly<T & CellWithColumnWidthProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
55
|
-
componentWillMount?(): void;
|
|
56
|
-
componentWillReceiveProps?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextContext: any): void;
|
|
57
|
-
componentWillUpdate?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
58
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<T & CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
59
|
-
};
|
|
60
|
-
contextTypes: {
|
|
61
|
-
tableTree: PropTypes.Validator<object>;
|
|
62
|
-
};
|
|
63
|
-
contextType?: React.Context<any> | undefined;
|
|
64
|
-
};
|
|
6
|
+
export default function withColumnWidth<T extends object>(Cell: React.ComponentType<T>): (props: T & CellWithColumnWidthProps) => JSX.Element;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
type ColumnWidth = string | number;
|
|
3
3
|
interface State {
|
|
4
|
-
columnWidths:
|
|
4
|
+
columnWidths: ColumnWidth[];
|
|
5
5
|
}
|
|
6
|
+
type TableTreeContext = {
|
|
7
|
+
setColumnWidth: (columnIndex: number, width: ColumnWidth) => void;
|
|
8
|
+
getColumnWidth: (columnIndex: number) => ColumnWidth | null;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* Context provider which maintains the column widths and access methods for use in descendent table cells
|
|
13
|
+
* Enables composed table-tree implementations to e.g. set width on header cells only
|
|
14
|
+
*/
|
|
15
|
+
export declare const TableTreeContext: React.Context<TableTreeContext>;
|
|
6
16
|
export default class TableTree extends Component<any, State> {
|
|
7
|
-
static childContextTypes: {
|
|
8
|
-
tableTree: PropTypes.Validator<object>;
|
|
9
|
-
};
|
|
10
17
|
state: State;
|
|
11
18
|
componentDidMount(): void;
|
|
12
|
-
setColumnWidth: (columnIndex: number, width:
|
|
13
|
-
getColumnWidth: (columnIndex: any) =>
|
|
14
|
-
getChildContext(): {
|
|
15
|
-
tableTree: {
|
|
16
|
-
columnWidths: number[];
|
|
17
|
-
setColumnWidth: (columnIndex: number, width: number) => void;
|
|
18
|
-
getColumnWidth: (columnIndex: any) => number | null;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
19
|
+
setColumnWidth: (columnIndex: number, width: ColumnWidth) => void;
|
|
20
|
+
getColumnWidth: (columnIndex: any) => ColumnWidth | null;
|
|
21
21
|
render(): JSX.Element;
|
|
22
22
|
}
|
|
23
23
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export interface CellProps {
|
|
3
3
|
/**
|
|
4
4
|
* Whether the cell contents should wrap or display on a single line and be concatenated.
|
|
@@ -16,63 +16,10 @@ export interface CellProps {
|
|
|
16
16
|
* Class name to apply to cell.
|
|
17
17
|
*/
|
|
18
18
|
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Children content, used when composing table-tree from internal components
|
|
21
|
+
*/
|
|
22
|
+
children?: ReactNode;
|
|
19
23
|
}
|
|
20
|
-
declare const _default:
|
|
21
|
-
new (props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>): {
|
|
22
|
-
UNSAFE_componentWillMount(): void;
|
|
23
|
-
setColumnWidth(width?: string | number | undefined): void;
|
|
24
|
-
UNSAFE_componentWillReceiveProps(nextProps: import("./internal/with-column-width").CellWithColumnWidthProps): void;
|
|
25
|
-
render(): JSX.Element;
|
|
26
|
-
context: any;
|
|
27
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
28
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
29
|
-
readonly props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps> & Readonly<{
|
|
30
|
-
children?: React.ReactNode;
|
|
31
|
-
}>;
|
|
32
|
-
state: Readonly<{}>;
|
|
33
|
-
refs: {
|
|
34
|
-
[key: string]: React.ReactInstance;
|
|
35
|
-
};
|
|
36
|
-
componentDidMount?(): void;
|
|
37
|
-
shouldComponentUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
38
|
-
componentWillUnmount?(): void;
|
|
39
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
40
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>): any;
|
|
41
|
-
componentDidUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
42
|
-
componentWillMount?(): void;
|
|
43
|
-
componentWillReceiveProps?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextContext: any): void;
|
|
44
|
-
componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
45
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
46
|
-
};
|
|
47
|
-
new (props: CellProps & import("./internal/with-column-width").CellWithColumnWidthProps, context?: any): {
|
|
48
|
-
UNSAFE_componentWillMount(): void;
|
|
49
|
-
setColumnWidth(width?: string | number | undefined): void;
|
|
50
|
-
UNSAFE_componentWillReceiveProps(nextProps: import("./internal/with-column-width").CellWithColumnWidthProps): void;
|
|
51
|
-
render(): JSX.Element;
|
|
52
|
-
context: any;
|
|
53
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
54
|
-
forceUpdate(callBack?: (() => void) | undefined): void;
|
|
55
|
-
readonly props: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps> & Readonly<{
|
|
56
|
-
children?: React.ReactNode;
|
|
57
|
-
}>;
|
|
58
|
-
state: Readonly<{}>;
|
|
59
|
-
refs: {
|
|
60
|
-
[key: string]: React.ReactInstance;
|
|
61
|
-
};
|
|
62
|
-
componentDidMount?(): void;
|
|
63
|
-
shouldComponentUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
64
|
-
componentWillUnmount?(): void;
|
|
65
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
66
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>): any;
|
|
67
|
-
componentDidUpdate?(prevProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
68
|
-
componentWillMount?(): void;
|
|
69
|
-
componentWillReceiveProps?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextContext: any): void;
|
|
70
|
-
componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
71
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<CellProps & import("./internal/with-column-width").CellWithColumnWidthProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
72
|
-
};
|
|
73
|
-
contextTypes: {
|
|
74
|
-
tableTree: import("prop-types").Validator<object>;
|
|
75
|
-
};
|
|
76
|
-
contextType?: React.Context<any> | undefined;
|
|
77
|
-
};
|
|
24
|
+
declare const _default: (props: CellProps & import("./internal/with-column-width").CellWithColumnWidthProps) => JSX.Element;
|
|
78
25
|
export default _default;
|