@atlaskit/table-tree 9.2.10 → 9.3.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/styled.js +2 -2
- package/dist/cjs/components/row.js +23 -4
- package/dist/cjs/components/table-tree.js +3 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/internal/styled.js +2 -2
- package/dist/es2019/components/row.js +25 -4
- package/dist/es2019/components/table-tree.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/internal/styled.js +2 -2
- package/dist/esm/components/row.js +24 -4
- package/dist/esm/components/table-tree.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/internal/common-cell.d.ts +2 -1
- package/dist/types/components/internal/overflow-container.d.ts +2 -1
- package/dist/types/components/internal/styled.d.ts +17 -7
- package/dist/types/components/row.d.ts +8 -1
- package/extract-react-types/table-tree-row.tsx +7 -0
- package/extract-react-types/table-tree.tsx +9 -0
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/table-tree
|
|
2
2
|
|
|
3
|
+
## 9.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6d99522bfa2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6d99522bfa2) - [ux] Adds `shouldExpandOnClick` prop for both TableTree and Row. This allows expansion of expandable rows when a user clicks anywhere on the row, along with the chevron at the head of the row.
|
|
8
|
+
|
|
9
|
+
## 9.2.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`261420360ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/261420360ec) - Upgrades component types to support React 18.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 9.2.10
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -39,9 +39,10 @@ var commonChevronContainerStyles = (0, _react.css)({
|
|
|
39
39
|
top: 7,
|
|
40
40
|
alignItems: 'center'
|
|
41
41
|
});
|
|
42
|
-
|
|
43
42
|
/**
|
|
44
43
|
* __Chevron container__
|
|
44
|
+
*
|
|
45
|
+
* A wrapper container around the expand table tree button.
|
|
45
46
|
*/
|
|
46
47
|
var ChevronContainer = function ChevronContainer(props
|
|
47
48
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -78,7 +79,6 @@ var paddingLeftStyles = (0, _react.css)({
|
|
|
78
79
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
79
80
|
paddingLeft: '50%'
|
|
80
81
|
});
|
|
81
|
-
|
|
82
82
|
/**
|
|
83
83
|
* __Loader item container__
|
|
84
84
|
*
|
|
@@ -15,6 +15,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
+
var _react2 = require("@emotion/react");
|
|
18
19
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
20
|
var _toItemId = _interopRequireDefault(require("../utils/to-item-id"));
|
|
20
21
|
var _chevron = _interopRequireDefault(require("./internal/chevron"));
|
|
@@ -23,8 +24,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
24
|
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; }
|
|
24
25
|
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); }; }
|
|
25
26
|
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; } }
|
|
27
|
+
var treeRowClickableStyles = (0, _react2.css)({
|
|
28
|
+
cursor: 'pointer'
|
|
29
|
+
});
|
|
26
30
|
var packageName = "@atlaskit/table-tree";
|
|
27
|
-
var packageVersion = "9.
|
|
31
|
+
var packageVersion = "9.3.0";
|
|
28
32
|
var Row = /*#__PURE__*/function (_Component) {
|
|
29
33
|
(0, _inherits2.default)(Row, _Component);
|
|
30
34
|
var _super = _createSuper(Row);
|
|
@@ -38,6 +42,13 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
38
42
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
39
43
|
isExpanded: _this.props.isDefaultExpanded || false
|
|
40
44
|
});
|
|
45
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClickHandler", function (e) {
|
|
46
|
+
var _window$getSelection;
|
|
47
|
+
var selection = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString()) || '';
|
|
48
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) === 0) {
|
|
49
|
+
_this.onExpandToggle();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
41
52
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onExpandToggle", function () {
|
|
42
53
|
var isExpanded = _this.props.isExpanded;
|
|
43
54
|
if (isExpanded !== undefined) {
|
|
@@ -75,6 +86,11 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* This ensures a user won't trigger a click event and expand the accordion
|
|
92
|
+
* when making a text selection.
|
|
93
|
+
*/
|
|
78
94
|
}, {
|
|
79
95
|
key: "isExpanded",
|
|
80
96
|
value: function isExpanded() {
|
|
@@ -92,7 +108,7 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
92
108
|
var indentLevel = isFirstCell ? depth : 0;
|
|
93
109
|
var cellContent = cell.props.children || [];
|
|
94
110
|
if (isFirstCell && hasChildren) {
|
|
95
|
-
cellContent = [
|
|
111
|
+
cellContent = [(0, _react2.jsx)(_chevron.default, {
|
|
96
112
|
key: "chevron",
|
|
97
113
|
expandLabel: props.expandLabel,
|
|
98
114
|
collapseLabel: props.collapseLabel,
|
|
@@ -112,6 +128,7 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
112
128
|
value: function render() {
|
|
113
129
|
var _this2 = this;
|
|
114
130
|
var _this$props2 = this.props,
|
|
131
|
+
shouldExpandOnClick = _this$props2.shouldExpandOnClick,
|
|
115
132
|
hasChildren = _this$props2.hasChildren,
|
|
116
133
|
depth = _this$props2.depth,
|
|
117
134
|
renderChildren = _this$props2.renderChildren;
|
|
@@ -123,8 +140,10 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
123
140
|
if (depth !== undefined) {
|
|
124
141
|
ariaAttrs['aria-level'] = depth;
|
|
125
142
|
}
|
|
126
|
-
return
|
|
127
|
-
role: "row"
|
|
143
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_styled.TreeRowContainer, (0, _extends2.default)({
|
|
144
|
+
role: "row",
|
|
145
|
+
css: hasChildren && shouldExpandOnClick ? treeRowClickableStyles : undefined,
|
|
146
|
+
onClick: hasChildren && shouldExpandOnClick ? this.onClickHandler : undefined
|
|
128
147
|
}, ariaAttrs), _react.default.Children.map(this.props.children, function (cell, index) {
|
|
129
148
|
return _this2.renderCell(cell, index);
|
|
130
149
|
})), hasChildren && isExpanded && renderChildren && renderChildren());
|
|
@@ -78,6 +78,7 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
78
78
|
value: function render() {
|
|
79
79
|
var _this$props = this.props,
|
|
80
80
|
items = _this$props.items,
|
|
81
|
+
shouldExpandOnClick = _this$props.shouldExpandOnClick,
|
|
81
82
|
headers = _this$props.headers,
|
|
82
83
|
columns = _this$props.columns,
|
|
83
84
|
_this$props$columnWid = _this$props.columnWidths,
|
|
@@ -105,7 +106,8 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
105
106
|
return /*#__PURE__*/_react.default.createElement(_row.default, {
|
|
106
107
|
itemId: id,
|
|
107
108
|
items: children,
|
|
108
|
-
hasChildren: hasChildren
|
|
109
|
+
hasChildren: hasChildren,
|
|
110
|
+
shouldExpandOnClick: shouldExpandOnClick
|
|
109
111
|
}, columns.map(function (CellContent, index) {
|
|
110
112
|
return /*#__PURE__*/_react.default.createElement(_cell.default
|
|
111
113
|
// eslint-disable-next-line react/no-array-index-key
|
package/dist/cjs/version.json
CHANGED
|
@@ -26,9 +26,10 @@ const commonChevronContainerStyles = css({
|
|
|
26
26
|
top: 7,
|
|
27
27
|
alignItems: 'center'
|
|
28
28
|
});
|
|
29
|
-
|
|
30
29
|
/**
|
|
31
30
|
* __Chevron container__
|
|
31
|
+
*
|
|
32
|
+
* A wrapper container around the expand table tree button.
|
|
32
33
|
*/
|
|
33
34
|
export const ChevronContainer = (props
|
|
34
35
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -59,7 +60,6 @@ const paddingLeftStyles = css({
|
|
|
59
60
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
60
61
|
paddingLeft: '50%'
|
|
61
62
|
});
|
|
62
|
-
|
|
63
63
|
/**
|
|
64
64
|
* __Loader item container__
|
|
65
65
|
*
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
/** @jsx jsx */
|
|
3
4
|
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
4
5
|
import React, { Component, Fragment } from 'react';
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
5
7
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
8
|
import toItemId from '../utils/to-item-id';
|
|
7
9
|
import Chevron from './internal/chevron';
|
|
8
10
|
import { TreeRowContainer } from './internal/styled';
|
|
11
|
+
const treeRowClickableStyles = css({
|
|
12
|
+
cursor: 'pointer'
|
|
13
|
+
});
|
|
9
14
|
const packageName = "@atlaskit/table-tree";
|
|
10
|
-
const packageVersion = "9.
|
|
15
|
+
const packageVersion = "9.3.0";
|
|
11
16
|
class Row extends Component {
|
|
12
17
|
constructor(...args) {
|
|
13
18
|
super(...args);
|
|
14
19
|
_defineProperty(this, "state", {
|
|
15
20
|
isExpanded: this.props.isDefaultExpanded || false
|
|
16
21
|
});
|
|
22
|
+
_defineProperty(this, "onClickHandler", e => {
|
|
23
|
+
var _window$getSelection;
|
|
24
|
+
const selection = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString()) || '';
|
|
25
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) === 0) {
|
|
26
|
+
this.onExpandToggle();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
17
29
|
_defineProperty(this, "onExpandToggle", () => {
|
|
18
30
|
const {
|
|
19
31
|
isExpanded
|
|
@@ -49,6 +61,12 @@ class Row extends Component {
|
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This ensures a user won't trigger a click event and expand the accordion
|
|
67
|
+
* when making a text selection.
|
|
68
|
+
*/
|
|
69
|
+
|
|
52
70
|
isExpanded() {
|
|
53
71
|
const {
|
|
54
72
|
isExpanded
|
|
@@ -68,7 +86,7 @@ class Row extends Component {
|
|
|
68
86
|
const indentLevel = isFirstCell ? depth : 0;
|
|
69
87
|
let cellContent = cell.props.children || [];
|
|
70
88
|
if (isFirstCell && hasChildren) {
|
|
71
|
-
cellContent = [
|
|
89
|
+
cellContent = [jsx(Chevron, {
|
|
72
90
|
key: "chevron",
|
|
73
91
|
expandLabel: props.expandLabel,
|
|
74
92
|
collapseLabel: props.collapseLabel,
|
|
@@ -85,6 +103,7 @@ class Row extends Component {
|
|
|
85
103
|
}
|
|
86
104
|
render() {
|
|
87
105
|
const {
|
|
106
|
+
shouldExpandOnClick,
|
|
88
107
|
hasChildren,
|
|
89
108
|
depth,
|
|
90
109
|
renderChildren
|
|
@@ -97,8 +116,10 @@ class Row extends Component {
|
|
|
97
116
|
if (depth !== undefined) {
|
|
98
117
|
ariaAttrs['aria-level'] = depth;
|
|
99
118
|
}
|
|
100
|
-
return
|
|
101
|
-
role: "row"
|
|
119
|
+
return jsx(Fragment, null, jsx(TreeRowContainer, _extends({
|
|
120
|
+
role: "row",
|
|
121
|
+
css: hasChildren && shouldExpandOnClick ? treeRowClickableStyles : undefined,
|
|
122
|
+
onClick: hasChildren && shouldExpandOnClick ? this.onClickHandler : undefined
|
|
102
123
|
}, ariaAttrs), React.Children.map(this.props.children, (cell, index) => this.renderCell(cell, index))), hasChildren && isExpanded && renderChildren && renderChildren());
|
|
103
124
|
}
|
|
104
125
|
}
|
|
@@ -50,6 +50,7 @@ export default class TableTree extends Component {
|
|
|
50
50
|
render() {
|
|
51
51
|
const {
|
|
52
52
|
items,
|
|
53
|
+
shouldExpandOnClick,
|
|
53
54
|
headers,
|
|
54
55
|
columns,
|
|
55
56
|
columnWidths = []
|
|
@@ -74,7 +75,8 @@ export default class TableTree extends Component {
|
|
|
74
75
|
}) => /*#__PURE__*/React.createElement(Row, {
|
|
75
76
|
itemId: id,
|
|
76
77
|
items: children,
|
|
77
|
-
hasChildren: hasChildren
|
|
78
|
+
hasChildren: hasChildren,
|
|
79
|
+
shouldExpandOnClick: shouldExpandOnClick
|
|
78
80
|
}, columns.map((CellContent, index) => /*#__PURE__*/React.createElement(Cell
|
|
79
81
|
// eslint-disable-next-line react/no-array-index-key
|
|
80
82
|
, {
|
package/dist/es2019/version.json
CHANGED
|
@@ -31,9 +31,10 @@ var commonChevronContainerStyles = css({
|
|
|
31
31
|
top: 7,
|
|
32
32
|
alignItems: 'center'
|
|
33
33
|
});
|
|
34
|
-
|
|
35
34
|
/**
|
|
36
35
|
* __Chevron container__
|
|
36
|
+
*
|
|
37
|
+
* A wrapper container around the expand table tree button.
|
|
37
38
|
*/
|
|
38
39
|
export var ChevronContainer = function ChevronContainer(props
|
|
39
40
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -68,7 +69,6 @@ var paddingLeftStyles = css({
|
|
|
68
69
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
69
70
|
paddingLeft: '50%'
|
|
70
71
|
});
|
|
71
|
-
|
|
72
72
|
/**
|
|
73
73
|
* __Loader item container__
|
|
74
74
|
*
|
|
@@ -8,14 +8,19 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
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); }; }
|
|
10
10
|
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; } }
|
|
11
|
+
/** @jsx jsx */
|
|
11
12
|
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
12
13
|
import React, { Component, Fragment } from 'react';
|
|
14
|
+
import { css, jsx } from '@emotion/react';
|
|
13
15
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
14
16
|
import toItemId from '../utils/to-item-id';
|
|
15
17
|
import Chevron from './internal/chevron';
|
|
16
18
|
import { TreeRowContainer } from './internal/styled';
|
|
19
|
+
var treeRowClickableStyles = css({
|
|
20
|
+
cursor: 'pointer'
|
|
21
|
+
});
|
|
17
22
|
var packageName = "@atlaskit/table-tree";
|
|
18
|
-
var packageVersion = "9.
|
|
23
|
+
var packageVersion = "9.3.0";
|
|
19
24
|
var Row = /*#__PURE__*/function (_Component) {
|
|
20
25
|
_inherits(Row, _Component);
|
|
21
26
|
var _super = _createSuper(Row);
|
|
@@ -29,6 +34,13 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
29
34
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
30
35
|
isExpanded: _this.props.isDefaultExpanded || false
|
|
31
36
|
});
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "onClickHandler", function (e) {
|
|
38
|
+
var _window$getSelection;
|
|
39
|
+
var selection = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString()) || '';
|
|
40
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) === 0) {
|
|
41
|
+
_this.onExpandToggle();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
32
44
|
_defineProperty(_assertThisInitialized(_this), "onExpandToggle", function () {
|
|
33
45
|
var isExpanded = _this.props.isExpanded;
|
|
34
46
|
if (isExpanded !== undefined) {
|
|
@@ -66,6 +78,11 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
66
78
|
}
|
|
67
79
|
}
|
|
68
80
|
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* This ensures a user won't trigger a click event and expand the accordion
|
|
84
|
+
* when making a text selection.
|
|
85
|
+
*/
|
|
69
86
|
}, {
|
|
70
87
|
key: "isExpanded",
|
|
71
88
|
value: function isExpanded() {
|
|
@@ -83,7 +100,7 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
83
100
|
var indentLevel = isFirstCell ? depth : 0;
|
|
84
101
|
var cellContent = cell.props.children || [];
|
|
85
102
|
if (isFirstCell && hasChildren) {
|
|
86
|
-
cellContent = [
|
|
103
|
+
cellContent = [jsx(Chevron, {
|
|
87
104
|
key: "chevron",
|
|
88
105
|
expandLabel: props.expandLabel,
|
|
89
106
|
collapseLabel: props.collapseLabel,
|
|
@@ -103,6 +120,7 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
103
120
|
value: function render() {
|
|
104
121
|
var _this2 = this;
|
|
105
122
|
var _this$props2 = this.props,
|
|
123
|
+
shouldExpandOnClick = _this$props2.shouldExpandOnClick,
|
|
106
124
|
hasChildren = _this$props2.hasChildren,
|
|
107
125
|
depth = _this$props2.depth,
|
|
108
126
|
renderChildren = _this$props2.renderChildren;
|
|
@@ -114,8 +132,10 @@ var Row = /*#__PURE__*/function (_Component) {
|
|
|
114
132
|
if (depth !== undefined) {
|
|
115
133
|
ariaAttrs['aria-level'] = depth;
|
|
116
134
|
}
|
|
117
|
-
return
|
|
118
|
-
role: "row"
|
|
135
|
+
return jsx(Fragment, null, jsx(TreeRowContainer, _extends({
|
|
136
|
+
role: "row",
|
|
137
|
+
css: hasChildren && shouldExpandOnClick ? treeRowClickableStyles : undefined,
|
|
138
|
+
onClick: hasChildren && shouldExpandOnClick ? this.onClickHandler : undefined
|
|
119
139
|
}, ariaAttrs), React.Children.map(this.props.children, function (cell, index) {
|
|
120
140
|
return _this2.renderCell(cell, index);
|
|
121
141
|
})), hasChildren && isExpanded && renderChildren && renderChildren());
|
|
@@ -69,6 +69,7 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
69
69
|
value: function render() {
|
|
70
70
|
var _this$props = this.props,
|
|
71
71
|
items = _this$props.items,
|
|
72
|
+
shouldExpandOnClick = _this$props.shouldExpandOnClick,
|
|
72
73
|
headers = _this$props.headers,
|
|
73
74
|
columns = _this$props.columns,
|
|
74
75
|
_this$props$columnWid = _this$props.columnWidths,
|
|
@@ -96,7 +97,8 @@ var TableTree = /*#__PURE__*/function (_Component) {
|
|
|
96
97
|
return /*#__PURE__*/React.createElement(Row, {
|
|
97
98
|
itemId: id,
|
|
98
99
|
items: children,
|
|
99
|
-
hasChildren: hasChildren
|
|
100
|
+
hasChildren: hasChildren,
|
|
101
|
+
shouldExpandOnClick: shouldExpandOnClick
|
|
100
102
|
}, columns.map(function (CellContent, index) {
|
|
101
103
|
return /*#__PURE__*/React.createElement(Cell
|
|
102
104
|
// eslint-disable-next-line react/no-array-index-key
|
package/dist/esm/version.json
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
export declare const iconColor: "var(--ds-text)";
|
|
4
4
|
export declare const indentBase: "var(--ds-space-300)";
|
|
5
5
|
/**
|
|
6
6
|
* __Tree row container__
|
|
7
7
|
*/
|
|
8
|
-
export declare const TreeRowContainer: FC<HTMLAttributes<HTMLDivElement
|
|
8
|
+
export declare const TreeRowContainer: FC<HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
declare type ChevronContainerProps = HTMLAttributes<HTMLSpanElement> & {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
9
14
|
/**
|
|
10
15
|
* __Chevron container__
|
|
16
|
+
*
|
|
17
|
+
* A wrapper container around the expand table tree button.
|
|
11
18
|
*/
|
|
12
|
-
export declare const ChevronContainer: FC<
|
|
19
|
+
export declare const ChevronContainer: FC<ChevronContainerProps>;
|
|
13
20
|
/**
|
|
14
21
|
* __Chevron icon container__
|
|
15
22
|
*
|
|
16
23
|
* A chevron icon container.
|
|
17
24
|
*/
|
|
18
|
-
export declare const ChevronIconContainer: FC<
|
|
25
|
+
export declare const ChevronIconContainer: FC<ChevronContainerProps>;
|
|
26
|
+
declare type LoaderItemContainerProps = {
|
|
27
|
+
isRoot?: boolean;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
};
|
|
19
30
|
/**
|
|
20
31
|
* __Loader item container__
|
|
21
32
|
*
|
|
22
33
|
* A loader item container.
|
|
23
34
|
*/
|
|
24
|
-
export declare const LoaderItemContainer: FC<
|
|
25
|
-
|
|
26
|
-
}>;
|
|
35
|
+
export declare const LoaderItemContainer: FC<LoaderItemContainerProps>;
|
|
36
|
+
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React, { Component } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
2
4
|
declare class Row extends Component<any, any> {
|
|
3
5
|
state: {
|
|
4
6
|
isExpanded: any;
|
|
5
7
|
};
|
|
6
8
|
componentDidUpdate(prevProps: any): void;
|
|
7
9
|
onExpandStateChange(isExpanded: boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
* This ensures a user won't trigger a click event and expand the accordion
|
|
12
|
+
* when making a text selection.
|
|
13
|
+
*/
|
|
14
|
+
onClickHandler: (e: React.MouseEvent) => void;
|
|
8
15
|
onExpandToggle: () => void;
|
|
9
16
|
isExpanded(): any;
|
|
10
17
|
renderCell(cell: any, cellIndex: number): React.FunctionComponentElement<{
|
|
@@ -12,7 +19,7 @@ declare class Row extends Component<any, any> {
|
|
|
12
19
|
columnIndex: number;
|
|
13
20
|
indentLevel: any;
|
|
14
21
|
}>;
|
|
15
|
-
render(): JSX.Element;
|
|
22
|
+
render(): jsx.JSX.Element;
|
|
16
23
|
}
|
|
17
24
|
export { Row as RowWithoutAnalytics };
|
|
18
25
|
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<any, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, string | number | symbol> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, string | number | symbol> & React.RefAttributes<any>>;
|
|
@@ -61,6 +61,13 @@ type RowProps = {
|
|
|
61
61
|
* Normally set by parent Item component and does not need to be configured.
|
|
62
62
|
*/
|
|
63
63
|
renderChildren?: () => React.ReactNode;
|
|
64
|
+
// eslint-disable-next-line jsdoc/require-asterisk-prefix, jsdoc/check-alignment
|
|
65
|
+
/**
|
|
66
|
+
Whether a row with children should expand when clicked anywhere within the row. If false or unset, a row with children will only expand when the chevron is clicked.
|
|
67
|
+
|
|
68
|
+
If your cells contain interactive elements, this can cause unexpected expanding or collapsing.
|
|
69
|
+
*/
|
|
70
|
+
shouldExpandOnClick?: boolean;
|
|
64
71
|
/**
|
|
65
72
|
* Data to render. Passed down by Item and passed into onExpand and onCollapse callbacks.
|
|
66
73
|
* Normally set by parent Item component and does not need to be configured.
|
|
@@ -37,6 +37,15 @@ type TableTreeProps = {
|
|
|
37
37
|
*/
|
|
38
38
|
headers?: string[];
|
|
39
39
|
// eslint-disable-next-line jsdoc/require-asterisk-prefix, jsdoc/check-alignment
|
|
40
|
+
/**
|
|
41
|
+
Whether a row with children should expand when clicked anywhere within the row. If false or unset, a row with children will only expand when the chevron is clicked.
|
|
42
|
+
|
|
43
|
+
If your cells contain interactive elements, this can cause unexpected expanding or collapsing.
|
|
44
|
+
|
|
45
|
+
If not using the `items` prop, `shouldExpandOnClick` should be used on the row component instead.
|
|
46
|
+
*/
|
|
47
|
+
shouldExpandOnClick?: boolean;
|
|
48
|
+
// eslint-disable-next-line jsdoc/require-asterisk-prefix, jsdoc/check-alignment
|
|
40
49
|
/**
|
|
41
50
|
The data used to render the table.
|
|
42
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/table-tree",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "A table tree is an expandable table for showing nested hierarchies of information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"homepage": "https://atlassian.design/components/table-tree/",
|
|
18
18
|
"atlassian": {
|
|
19
|
-
"disableProductCI": true,
|
|
20
19
|
"team": "Design System Team",
|
|
21
20
|
"releaseModel": "scheduled",
|
|
22
21
|
"website": {
|
|
@@ -29,10 +28,10 @@
|
|
|
29
28
|
},
|
|
30
29
|
"dependencies": {
|
|
31
30
|
"@atlaskit/analytics-next": "^9.0.0",
|
|
32
|
-
"@atlaskit/button": "^16.
|
|
31
|
+
"@atlaskit/button": "^16.6.0",
|
|
33
32
|
"@atlaskit/icon": "^21.11.0",
|
|
34
|
-
"@atlaskit/spinner": "^15.
|
|
35
|
-
"@atlaskit/theme": "^12.
|
|
33
|
+
"@atlaskit/spinner": "^15.4.0",
|
|
34
|
+
"@atlaskit/theme": "^12.3.0",
|
|
36
35
|
"@atlaskit/tokens": "^1.2.0",
|
|
37
36
|
"@babel/runtime": "^7.0.0",
|
|
38
37
|
"@emotion/react": "^11.7.1",
|