@atlaskit/table-tree 9.5.0 → 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 +6 -0
- package/dist/cjs/components/internal/with-column-width.js +23 -49
- package/dist/cjs/components/row.js +1 -1
- package/dist/cjs/components/table-tree.js +21 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/internal/with-column-width.js +27 -29
- package/dist/es2019/components/row.js +1 -1
- package/dist/es2019/components/table-tree.js +18 -17
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/internal/with-column-width.js +24 -51
- package/dist/esm/components/row.js +1 -1
- 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 +6 -7
- package/report.api.md +9 -268
- package/tmp/api-report-tmp.d.ts +109 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,60 +8,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = withColumnWidth;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
-
var
|
|
12
|
+
var _tableTree = require("../table-tree");
|
|
19
13
|
var _excluded = ["width", "columnIndex"];
|
|
20
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
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; }
|
|
22
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
|
-
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; } } /* eslint-disable react/prop-types */
|
|
24
16
|
function withColumnWidth(Cell) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
value: function UNSAFE_componentWillMount() {
|
|
36
|
-
this.setColumnWidth(this.props.width);
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
key: "setColumnWidth",
|
|
40
|
-
value: function setColumnWidth(width) {
|
|
41
|
-
if (width !== undefined) {
|
|
42
|
-
this.context.tableTree.setColumnWidth(this.props.columnIndex, width);
|
|
43
|
-
}
|
|
17
|
+
return function (props) {
|
|
18
|
+
var _useContext = (0, _react.useContext)(_tableTree.TableTreeContext),
|
|
19
|
+
setColumnWidth = _useContext.setColumnWidth,
|
|
20
|
+
getColumnWidth = _useContext.getColumnWidth;
|
|
21
|
+
var width = props.width,
|
|
22
|
+
columnIndex = props.columnIndex,
|
|
23
|
+
other = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
24
|
+
(0, _react.useEffect)(function () {
|
|
25
|
+
if (width !== undefined && columnIndex !== undefined) {
|
|
26
|
+
setColumnWidth(columnIndex, width);
|
|
44
27
|
}
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
}, [width, columnIndex, setColumnWidth]);
|
|
29
|
+
var columnWidth;
|
|
30
|
+
if (width !== null && width !== undefined) {
|
|
31
|
+
columnWidth = width;
|
|
32
|
+
} else {
|
|
33
|
+
if (columnIndex !== undefined) {
|
|
34
|
+
columnWidth = getColumnWidth(columnIndex);
|
|
49
35
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
columnIndex = _this$props.columnIndex,
|
|
56
|
-
other = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
57
|
-
var columnWidth = width !== null && width !== undefined ? width : this.context.tableTree.getColumnWidth(columnIndex);
|
|
58
|
-
return /*#__PURE__*/_react.default.createElement(Cell, (0, _extends2.default)({
|
|
59
|
-
width: columnWidth
|
|
60
|
-
}, other));
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
63
|
-
return CellWithColumnWidth;
|
|
64
|
-
}(_react.Component), (0, _defineProperty2.default)(_class, "contextTypes", {
|
|
65
|
-
tableTree: _propTypes.default.object.isRequired
|
|
66
|
-
}), _class;
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(Cell, (0, _extends2.default)({
|
|
38
|
+
width: columnWidth
|
|
39
|
+
}, other));
|
|
40
|
+
};
|
|
67
41
|
}
|
|
@@ -28,7 +28,7 @@ var treeRowClickableStyles = (0, _react2.css)({
|
|
|
28
28
|
cursor: 'pointer'
|
|
29
29
|
});
|
|
30
30
|
var packageName = "@atlaskit/table-tree";
|
|
31
|
-
var packageVersion = "9.
|
|
31
|
+
var packageVersion = "9.6.0";
|
|
32
32
|
var Row = /*#__PURE__*/function (_Component) {
|
|
33
33
|
(0, _inherits2.default)(Row, _Component);
|
|
34
34
|
var _super = _createSuper(Row);
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.TableTreeContext = void 0;
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -14,7 +14,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
17
|
var _cell = _interopRequireDefault(require("./cell"));
|
|
19
18
|
var _header = _interopRequireDefault(require("./header"));
|
|
20
19
|
var _headers = _interopRequireDefault(require("./headers"));
|
|
@@ -24,6 +23,18 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
24
23
|
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; }
|
|
25
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
26
25
|
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; } } /* eslint-disable react/prop-types */
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* Context provider which maintains the column widths and access methods for use in descendent table cells
|
|
29
|
+
* Enables composed table-tree implementations to e.g. set width on header cells only
|
|
30
|
+
*/
|
|
31
|
+
var TableTreeContext = /*#__PURE__*/(0, _react.createContext)({
|
|
32
|
+
setColumnWidth: function setColumnWidth() {},
|
|
33
|
+
getColumnWidth: function getColumnWidth() {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.TableTreeContext = TableTreeContext;
|
|
27
38
|
var TableTree = /*#__PURE__*/function (_Component) {
|
|
28
39
|
(0, _inherits2.default)(TableTree, _Component);
|
|
29
40
|
var _super = _createSuper(TableTree);
|
|
@@ -62,17 +73,6 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
62
73
|
}); // eslint-disable-line
|
|
63
74
|
}
|
|
64
75
|
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "getChildContext",
|
|
67
|
-
value: function getChildContext() {
|
|
68
|
-
return {
|
|
69
|
-
tableTree: {
|
|
70
|
-
columnWidths: this.state.columnWidths,
|
|
71
|
-
setColumnWidth: this.setColumnWidth,
|
|
72
|
-
getColumnWidth: this.getColumnWidth
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
76
|
}, {
|
|
77
77
|
key: "render",
|
|
78
78
|
value: function render() {
|
|
@@ -122,15 +122,17 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement(TableTreeContext.Provider, {
|
|
126
|
+
value: {
|
|
127
|
+
setColumnWidth: this.setColumnWidth,
|
|
128
|
+
getColumnWidth: this.getColumnWidth
|
|
129
|
+
}
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
131
|
role: "treegrid",
|
|
127
132
|
"aria-readonly": true
|
|
128
|
-
}, heads, rows, this.props.children);
|
|
133
|
+
}, heads, rows, this.props.children));
|
|
129
134
|
}
|
|
130
135
|
}]);
|
|
131
136
|
return TableTree;
|
|
132
137
|
}(_react.Component);
|
|
133
|
-
exports.default = TableTree;
|
|
134
|
-
(0, _defineProperty2.default)(TableTree, "childContextTypes", {
|
|
135
|
-
tableTree: _propTypes.default.object.isRequired
|
|
136
|
-
});
|
|
138
|
+
exports.default = TableTree;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import React, { Component } from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
|
+
import { TableTreeContext } from '../table-tree';
|
|
6
4
|
export default function withColumnWidth(Cell) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
return props => {
|
|
6
|
+
const {
|
|
7
|
+
setColumnWidth,
|
|
8
|
+
getColumnWidth
|
|
9
|
+
} = useContext(TableTreeContext);
|
|
10
|
+
const {
|
|
11
|
+
width,
|
|
12
|
+
columnIndex,
|
|
13
|
+
...other
|
|
14
|
+
} = props;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (width !== undefined && columnIndex !== undefined) {
|
|
17
|
+
setColumnWidth(columnIndex, width);
|
|
18
|
+
}
|
|
19
|
+
}, [width, columnIndex, setColumnWidth]);
|
|
20
|
+
let columnWidth;
|
|
21
|
+
if (width !== null && width !== undefined) {
|
|
22
|
+
columnWidth = width;
|
|
23
|
+
} else {
|
|
24
|
+
if (columnIndex !== undefined) {
|
|
25
|
+
columnWidth = getColumnWidth(columnIndex);
|
|
15
26
|
}
|
|
16
27
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
width,
|
|
23
|
-
columnIndex,
|
|
24
|
-
...other
|
|
25
|
-
} = this.props;
|
|
26
|
-
const columnWidth = width !== null && width !== undefined ? width : this.context.tableTree.getColumnWidth(columnIndex);
|
|
27
|
-
return /*#__PURE__*/React.createElement(Cell, _extends({
|
|
28
|
-
width: columnWidth
|
|
29
|
-
}, other));
|
|
30
|
-
}
|
|
31
|
-
}, _defineProperty(_class, "contextTypes", {
|
|
32
|
-
tableTree: PropTypes.object.isRequired
|
|
33
|
-
}), _class;
|
|
28
|
+
return /*#__PURE__*/React.createElement(Cell, _extends({
|
|
29
|
+
width: columnWidth
|
|
30
|
+
}, other));
|
|
31
|
+
};
|
|
34
32
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
/* eslint-disable react/prop-types */
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
3
|
+
import React, { Component, createContext } from 'react';
|
|
5
4
|
import Cell from './cell';
|
|
6
5
|
import Header from './header';
|
|
7
6
|
import Headers from './headers';
|
|
8
7
|
import Row from './row';
|
|
9
8
|
import Rows from './rows';
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* Context provider which maintains the column widths and access methods for use in descendent table cells
|
|
12
|
+
* Enables composed table-tree implementations to e.g. set width on header cells only
|
|
13
|
+
*/
|
|
14
|
+
export const TableTreeContext = /*#__PURE__*/createContext({
|
|
15
|
+
setColumnWidth: () => {},
|
|
16
|
+
getColumnWidth: () => null
|
|
17
|
+
});
|
|
10
18
|
export default class TableTree extends Component {
|
|
11
19
|
constructor(...args) {
|
|
12
20
|
super(...args);
|
|
@@ -38,15 +46,6 @@ export default class TableTree extends Component {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
getChildContext() {
|
|
42
|
-
return {
|
|
43
|
-
tableTree: {
|
|
44
|
-
columnWidths: this.state.columnWidths,
|
|
45
|
-
setColumnWidth: this.setColumnWidth,
|
|
46
|
-
getColumnWidth: this.getColumnWidth
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
49
|
render() {
|
|
51
50
|
const {
|
|
52
51
|
items,
|
|
@@ -90,12 +89,14 @@ export default class TableTree extends Component {
|
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
|
-
return /*#__PURE__*/React.createElement(
|
|
92
|
+
return /*#__PURE__*/React.createElement(TableTreeContext.Provider, {
|
|
93
|
+
value: {
|
|
94
|
+
setColumnWidth: this.setColumnWidth,
|
|
95
|
+
getColumnWidth: this.getColumnWidth
|
|
96
|
+
}
|
|
97
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
94
98
|
role: "treegrid",
|
|
95
99
|
"aria-readonly": true
|
|
96
|
-
}, heads, rows, this.props.children);
|
|
100
|
+
}, heads, rows, this.props.children));
|
|
97
101
|
}
|
|
98
|
-
}
|
|
99
|
-
_defineProperty(TableTree, "childContextTypes", {
|
|
100
|
-
tableTree: PropTypes.object.isRequired
|
|
101
|
-
});
|
|
102
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -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);
|
|
@@ -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;
|