@atlaskit/table-tree 9.4.2 → 9.6.0
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 +13 -0
- package/dist/cjs/components/internal/chevron.js +8 -3
- package/dist/cjs/components/internal/with-column-width.js +23 -49
- package/dist/cjs/components/row.js +19 -3
- package/dist/cjs/components/table-tree.js +25 -21
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/internal/chevron.js +6 -3
- package/dist/es2019/components/internal/with-column-width.js +27 -29
- package/dist/es2019/components/row.js +19 -3
- package/dist/es2019/components/table-tree.js +35 -30
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/internal/chevron.js +8 -3
- package/dist/esm/components/internal/with-column-width.js +24 -51
- package/dist/esm/components/row.js +19 -3
- package/dist/esm/components/table-tree.js +23 -20
- 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/chevron.d.ts +2 -0
- package/dist/types/components/internal/with-column-width.d.ts +2 -60
- package/dist/types/components/row.d.ts +1 -0
- 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/chevron.d.ts +2 -0
- package/dist/types-ts4.5/components/internal/with-column-width.d.ts +2 -60
- package/dist/types-ts4.5/components/row.d.ts +1 -0
- package/dist/types-ts4.5/components/table-tree.d.ts +15 -15
- package/extract-react-types/table-tree-row.tsx +9 -0
- package/extract-react-types/table-tree.tsx +7 -0
- package/package.json +7 -8
- package/report.api.md +9 -268
- package/tmp/api-report-tmp.d.ts +109 -0
|
@@ -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.0";
|
|
24
24
|
var Row = /*#__PURE__*/function (_Component) {
|
|
25
25
|
_inherits(Row, _Component);
|
|
26
26
|
var _super = _createSuper(Row);
|
|
@@ -56,6 +56,18 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
56
56
|
_this.onExpandStateChange(!_this.state.isExpanded);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "getExtendedLabel", function (cellContent, cellIndex, mainColumnForExpandCollapseLabel) {
|
|
60
|
+
/**
|
|
61
|
+
* First condition - when we pass data via `items` property in `<TableTree />`
|
|
62
|
+
* Second condition - when we pass data via `<Rows />` as children in `<TableTree />`.
|
|
63
|
+
*/
|
|
64
|
+
if (cellContent.hasOwnProperty('props')) {
|
|
65
|
+
return cellContent === null || cellContent === void 0 ? void 0 : cellContent.props[mainColumnForExpandCollapseLabel === null || mainColumnForExpandCollapseLabel === void 0 ? void 0 : mainColumnForExpandCollapseLabel.toLowerCase()];
|
|
66
|
+
} else if (cellIndex === mainColumnForExpandCollapseLabel) {
|
|
67
|
+
return cellContent;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
});
|
|
59
71
|
return _this;
|
|
60
72
|
}
|
|
61
73
|
_createClass(Row, [{
|
|
@@ -94,18 +106,22 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
94
106
|
var props = this.props;
|
|
95
107
|
var isExpanded = this.isExpanded();
|
|
96
108
|
var hasChildren = props.hasChildren,
|
|
97
|
-
depth = props.depth
|
|
109
|
+
depth = props.depth,
|
|
110
|
+
mainColumnForExpandCollapseLabel = props.mainColumnForExpandCollapseLabel;
|
|
98
111
|
var isFirstCell = cellIndex === 0;
|
|
99
112
|
var indentLevel = isFirstCell ? depth : 0;
|
|
100
113
|
var cellContent = cell.props.children || [];
|
|
114
|
+
var extendedLabel = this.getExtendedLabel(cellContent, cellIndex, mainColumnForExpandCollapseLabel);
|
|
101
115
|
if (isFirstCell && hasChildren) {
|
|
102
116
|
cellContent = [jsx(Chevron, {
|
|
103
117
|
key: "chevron",
|
|
104
118
|
expandLabel: props.expandLabel,
|
|
105
119
|
collapseLabel: props.collapseLabel,
|
|
120
|
+
extendedLabel: extendedLabel,
|
|
106
121
|
isExpanded: isExpanded,
|
|
107
122
|
onExpandToggle: this.onExpandToggle,
|
|
108
|
-
ariaControls: toItemId(props.itemId)
|
|
123
|
+
ariaControls: toItemId(props.itemId),
|
|
124
|
+
rowId: props.itemId
|
|
109
125
|
})].concat(cellContent);
|
|
110
126
|
}
|
|
111
127
|
return /*#__PURE__*/React.cloneElement(cell, {
|
|
@@ -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() {
|
|
@@ -73,7 +72,8 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
73
72
|
headers = _this$props.headers,
|
|
74
73
|
columns = _this$props.columns,
|
|
75
74
|
_this$props$columnWid = _this$props.columnWidths,
|
|
76
|
-
columnWidths = _this$props$columnWid === void 0 ? [] : _this$props$columnWid
|
|
75
|
+
columnWidths = _this$props$columnWid === void 0 ? [] : _this$props$columnWid,
|
|
76
|
+
mainColumnForExpandCollapseLabel = _this$props.mainColumnForExpandCollapseLabel;
|
|
77
77
|
var heads = headers && /*#__PURE__*/React.createElement(Headers, null, headers.map(function (header, index) {
|
|
78
78
|
return (
|
|
79
79
|
/*#__PURE__*/
|
|
@@ -98,7 +98,8 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
98
98
|
itemId: id,
|
|
99
99
|
items: children,
|
|
100
100
|
hasChildren: hasChildren,
|
|
101
|
-
shouldExpandOnClick: shouldExpandOnClick
|
|
101
|
+
shouldExpandOnClick: shouldExpandOnClick,
|
|
102
|
+
mainColumnForExpandCollapseLabel: mainColumnForExpandCollapseLabel
|
|
102
103
|
}, columns.map(function (CellContent, index) {
|
|
103
104
|
return /*#__PURE__*/React.createElement(Cell
|
|
104
105
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -111,15 +112,17 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
111
112
|
}
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
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", {
|
|
115
121
|
role: "treegrid",
|
|
116
122
|
"aria-readonly": true
|
|
117
|
-
}, heads, rows, this.props.children);
|
|
123
|
+
}, heads, rows, this.props.children));
|
|
118
124
|
}
|
|
119
125
|
}]);
|
|
120
126
|
return TableTree;
|
|
121
127
|
}(Component);
|
|
122
|
-
_defineProperty(TableTree, "childContextTypes", {
|
|
123
|
-
tableTree: PropTypes.object.isRequired
|
|
124
|
-
});
|
|
125
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;
|
|
@@ -14,6 +14,7 @@ declare class Row extends Component<any, any> {
|
|
|
14
14
|
onClickHandler: (e: React.MouseEvent) => void;
|
|
15
15
|
onExpandToggle: () => void;
|
|
16
16
|
isExpanded(): any;
|
|
17
|
+
getExtendedLabel: (cellContent: any, cellIndex: number, mainColumnForExpandCollapseLabel: string | number) => any;
|
|
17
18
|
renderCell(cell: any, cellIndex: number): React.FunctionComponentElement<{
|
|
18
19
|
key: number;
|
|
19
20
|
columnIndex: number;
|
|
@@ -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;
|
|
@@ -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;
|