@atlaskit/table-tree 9.0.12 → 9.0.13
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 +17 -0
- package/dist/cjs/components/{Cell.js → cell.js} +23 -8
- package/dist/cjs/components/{Header.js → header.js} +19 -9
- package/dist/cjs/components/{Headers.js → headers.js} +11 -11
- package/dist/cjs/components/{Chevron.js → internal/chevron.js} +1 -1
- package/dist/cjs/components/internal/common-cell.js +45 -0
- package/dist/cjs/components/{Item.js → internal/item.js} +7 -11
- package/dist/cjs/components/{Items.js → internal/items.js} +4 -4
- package/dist/cjs/components/{LoaderItem.js → internal/loader-item.js} +10 -10
- package/dist/cjs/components/internal/overflow-container.js +35 -0
- package/dist/cjs/components/internal/styled.js +92 -0
- package/dist/cjs/components/{withColumnWidth.js → internal/with-column-width.js} +6 -3
- package/dist/cjs/components/{Row.js → row.js} +5 -5
- package/dist/cjs/components/{Rows.js → rows.js} +2 -3
- package/dist/cjs/components/{TableTree.js → table-tree.js} +11 -13
- package/dist/cjs/index.js +14 -14
- package/dist/cjs/utils/{TableTreeDataHelper.js → table-tree-data-helper.js} +0 -2
- package/dist/cjs/utils/{toItemId.js → to-item-id.js} +0 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/cell.js +31 -0
- package/dist/es2019/components/header.js +35 -0
- package/dist/es2019/components/headers.js +24 -0
- package/dist/es2019/components/internal/chevron.js +51 -0
- package/dist/es2019/components/internal/common-cell.js +30 -0
- package/dist/es2019/components/internal/item.js +46 -0
- package/dist/es2019/components/internal/items.js +76 -0
- package/dist/es2019/components/internal/loader-item.js +60 -0
- package/dist/es2019/components/internal/overflow-container.js +21 -0
- package/dist/es2019/components/internal/styled.js +63 -0
- package/dist/es2019/components/internal/with-column-width.js +40 -0
- package/dist/es2019/components/row.js +148 -0
- package/dist/es2019/components/rows.js +15 -0
- package/dist/es2019/components/table-tree.js +107 -0
- package/dist/es2019/index.js +7 -0
- package/dist/es2019/utils/table-tree-data-helper.js +130 -0
- package/dist/es2019/utils/to-item-id.js +3 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/{Cell.js → cell.js} +21 -7
- package/dist/esm/components/{Header.js → header.js} +21 -5
- package/dist/esm/components/{Headers.js → headers.js} +13 -5
- package/dist/esm/components/{Chevron.js → internal/chevron.js} +3 -1
- package/dist/esm/components/internal/common-cell.js +33 -0
- package/dist/esm/components/{Item.js → internal/item.js} +10 -6
- package/dist/esm/components/{Items.js → internal/items.js} +2 -2
- package/dist/esm/components/{LoaderItem.js → internal/loader-item.js} +11 -10
- package/dist/esm/components/internal/overflow-container.js +24 -0
- package/dist/esm/components/internal/styled.js +72 -0
- package/dist/esm/components/{withColumnWidth.js → internal/with-column-width.js} +6 -3
- package/dist/esm/components/{Row.js → row.js} +5 -5
- package/dist/esm/components/{Rows.js → rows.js} +1 -2
- package/dist/esm/components/{TableTree.js → table-tree.js} +6 -7
- package/dist/esm/index.js +7 -7
- package/dist/esm/utils/{TableTreeDataHelper.js → table-tree-data-helper.js} +0 -4
- package/dist/esm/utils/{toItemId.js → to-item-id.js} +0 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/cell.d.ts +66 -0
- package/dist/types/components/header.d.ts +60 -0
- package/dist/types/components/headers.d.ts +5 -0
- package/dist/types/components/internal/chevron.d.ts +17 -0
- package/dist/types/components/internal/common-cell.d.ts +10 -0
- package/dist/types/components/internal/item.d.ts +12 -0
- package/dist/types/components/internal/items.d.ts +24 -0
- package/dist/types/components/internal/loader-item.d.ts +20 -0
- package/dist/types/components/internal/overflow-container.d.ts +10 -0
- package/dist/types/components/internal/styled.d.ts +25 -0
- package/dist/types/components/internal/with-column-width.d.ts +64 -0
- package/dist/types/components/row.d.ts +19 -0
- package/dist/types/components/rows.d.ts +12 -0
- package/dist/types/components/table-tree.d.ts +23 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/utils/table-tree-data-helper.d.ts +25 -0
- package/dist/types/utils/to-item-id.d.ts +1 -0
- package/package.json +23 -6
- package/dist/cjs/styled.js +0 -111
- package/dist/esm/styled.js +0 -68
- package/styled/package.json +0 -6
package/dist/cjs/index.js
CHANGED
|
@@ -8,56 +8,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
Object.defineProperty(exports, "default", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
11
|
-
return
|
|
11
|
+
return _tableTree.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "Headers", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _headers.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "Header", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function get() {
|
|
23
|
-
return
|
|
23
|
+
return _header.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "Cell", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return
|
|
29
|
+
return _cell.default;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "Rows", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function get() {
|
|
35
|
-
return
|
|
35
|
+
return _rows.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "Row", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function get() {
|
|
41
|
-
return
|
|
41
|
+
return _row.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "TableTreeDataHelper", {
|
|
45
45
|
enumerable: true,
|
|
46
46
|
get: function get() {
|
|
47
|
-
return
|
|
47
|
+
return _tableTreeDataHelper.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _tableTree = _interopRequireDefault(require("./components/table-tree"));
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _headers = _interopRequireDefault(require("./components/headers"));
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var _header = _interopRequireDefault(require("./components/header"));
|
|
56
56
|
|
|
57
|
-
var
|
|
57
|
+
var _cell = _interopRequireDefault(require("./components/cell"));
|
|
58
58
|
|
|
59
|
-
var
|
|
59
|
+
var _rows = _interopRequireDefault(require("./components/rows"));
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var _row = _interopRequireDefault(require("./components/row"));
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _tableTreeDataHelper = _interopRequireDefault(require("./utils/table-tree-data-helper"));
|
|
@@ -103,8 +103,6 @@ var TableTreeDataHelper = /*#__PURE__*/function () {
|
|
|
103
103
|
key = _ref3$key === void 0 ? 'key' : _ref3$key;
|
|
104
104
|
|
|
105
105
|
(0, _classCallCheck2.default)(this, TableTreeDataHelper);
|
|
106
|
-
(0, _defineProperty2.default)(this, "key", void 0);
|
|
107
|
-
(0, _defineProperty2.default)(this, "keysCache", void 0);
|
|
108
106
|
this.key = key;
|
|
109
107
|
this.keysCache = {};
|
|
110
108
|
}
|
|
File without changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import CommonCell from './internal/common-cell';
|
|
4
|
+
import OverflowContainer from './internal/overflow-container';
|
|
5
|
+
import withColumnWidth from './internal/with-column-width';
|
|
6
|
+
|
|
7
|
+
class Cell extends Component {
|
|
8
|
+
render() {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
singleLine,
|
|
12
|
+
indentLevel,
|
|
13
|
+
width,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
} = this.props;
|
|
17
|
+
return /*#__PURE__*/React.createElement(CommonCell, _extends({
|
|
18
|
+
role: "gridcell",
|
|
19
|
+
indent: indentLevel ? `${25 * indentLevel}` : undefined,
|
|
20
|
+
style: {
|
|
21
|
+
width
|
|
22
|
+
},
|
|
23
|
+
className: className
|
|
24
|
+
}, props), /*#__PURE__*/React.createElement(OverflowContainer, {
|
|
25
|
+
isSingleLine: singleLine
|
|
26
|
+
}, children));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default withColumnWidth(Cell);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
6
|
+
import { Component } from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import { N300 } from '@atlaskit/theme/colors';
|
|
9
|
+
import ColumnCell from './internal/common-cell';
|
|
10
|
+
import withColumnWidth from './internal/with-column-width';
|
|
11
|
+
const headerStyles = css({
|
|
12
|
+
color: `var(--ds-text-mediumEmphasis, ${N300})`,
|
|
13
|
+
fontSize: 12,
|
|
14
|
+
fontWeight: 'bold',
|
|
15
|
+
letterSpacing: -0.1,
|
|
16
|
+
lineHeight: '1.67'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
class Header extends Component {
|
|
20
|
+
render() {
|
|
21
|
+
const {
|
|
22
|
+
props
|
|
23
|
+
} = this;
|
|
24
|
+
return jsx(ColumnCell, _extends({
|
|
25
|
+
css: headerStyles,
|
|
26
|
+
role: "columnheader",
|
|
27
|
+
style: {
|
|
28
|
+
width: props.width
|
|
29
|
+
}
|
|
30
|
+
}, props), props.children);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default withColumnWidth(Header);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
4
|
+
import { Children, cloneElement, Component } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
|
+
const containerStyles = css({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
borderBottom: `solid 2px ${"var(--ds-border-neutral, #dfe1e6)"}`
|
|
9
|
+
});
|
|
10
|
+
export default class Headers extends Component {
|
|
11
|
+
render() {
|
|
12
|
+
return jsx("div", {
|
|
13
|
+
css: containerStyles,
|
|
14
|
+
role: "row"
|
|
15
|
+
}, Children.map(this.props.children, (header, index) =>
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
18
|
+
cloneElement(header, {
|
|
19
|
+
key: index,
|
|
20
|
+
columnIndex: index
|
|
21
|
+
})));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @repo/internal/react/consistent-props-definitions */
|
|
5
|
+
|
|
6
|
+
/* eslint-disable react/prop-types */
|
|
7
|
+
import React, { Component } from 'react';
|
|
8
|
+
import Button from '@atlaskit/button';
|
|
9
|
+
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
10
|
+
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
11
|
+
import { ChevronContainer, ChevronIconContainer, iconColor } from './styled';
|
|
12
|
+
export default class Chevron extends Component {
|
|
13
|
+
constructor(...args) {
|
|
14
|
+
super(...args);
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "handleClick", () => {
|
|
17
|
+
if (this.props.onExpandToggle) {
|
|
18
|
+
this.props.onExpandToggle();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
const {
|
|
25
|
+
isExpanded,
|
|
26
|
+
ariaControls,
|
|
27
|
+
collapseLabel,
|
|
28
|
+
expandLabel
|
|
29
|
+
} = this.props;
|
|
30
|
+
const iconProps = {
|
|
31
|
+
size: 'medium',
|
|
32
|
+
primaryColor: iconColor
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/React.createElement(ChevronContainer, null, /*#__PURE__*/React.createElement(Button, {
|
|
35
|
+
spacing: "none",
|
|
36
|
+
appearance: "subtle",
|
|
37
|
+
"aria-controls": ariaControls,
|
|
38
|
+
onClick: this.handleClick
|
|
39
|
+
}, /*#__PURE__*/React.createElement(ChevronIconContainer, null, isExpanded ? /*#__PURE__*/React.createElement(ChevronDownIcon, _extends({
|
|
40
|
+
label: collapseLabel
|
|
41
|
+
}, iconProps)) : /*#__PURE__*/React.createElement(ChevronRightIcon, _extends({
|
|
42
|
+
label: expandLabel
|
|
43
|
+
}, iconProps)))));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_defineProperty(Chevron, "defaultProps", {
|
|
49
|
+
expandLabel: 'Expand',
|
|
50
|
+
collapseLabel: 'Collapse'
|
|
51
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
import { N800 } from '@atlaskit/theme/colors';
|
|
6
|
+
const commonStyles = css({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
boxSizing: 'border-box',
|
|
9
|
+
minHeight: 40,
|
|
10
|
+
padding: '10px 25px 10px var(--indent, 25px)',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
alignItems: 'flex-start',
|
|
13
|
+
color: `var(--ds-text-highEmphasis, ${N800})`,
|
|
14
|
+
lineHeight: '20px'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* __Common cell__
|
|
19
|
+
*/
|
|
20
|
+
const CommonCell = ({
|
|
21
|
+
indent,
|
|
22
|
+
...props
|
|
23
|
+
}) => jsx("div", _extends({
|
|
24
|
+
style: {
|
|
25
|
+
'--indent': indent
|
|
26
|
+
},
|
|
27
|
+
css: commonStyles
|
|
28
|
+
}, props));
|
|
29
|
+
|
|
30
|
+
export default CommonCell;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
6
|
+
import { cloneElement, Component } from 'react';
|
|
7
|
+
import { jsx } from '@emotion/core';
|
|
8
|
+
import toItemId from '../../utils/to-item-id';
|
|
9
|
+
import Items from './items';
|
|
10
|
+
export default class Item extends Component {
|
|
11
|
+
render() {
|
|
12
|
+
// eslint-disable-next-line react/prop-types
|
|
13
|
+
const {
|
|
14
|
+
depth,
|
|
15
|
+
data,
|
|
16
|
+
render
|
|
17
|
+
} = this.props;
|
|
18
|
+
const renderedRow = render(data);
|
|
19
|
+
|
|
20
|
+
if (!renderedRow) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
itemId,
|
|
26
|
+
items
|
|
27
|
+
} = renderedRow.props;
|
|
28
|
+
return /*#__PURE__*/cloneElement(renderedRow, {
|
|
29
|
+
depth,
|
|
30
|
+
data,
|
|
31
|
+
renderChildren: () => jsx("div", {
|
|
32
|
+
id: toItemId(itemId)
|
|
33
|
+
}, jsx(Items, {
|
|
34
|
+
parentData: data,
|
|
35
|
+
depth: depth,
|
|
36
|
+
items: items,
|
|
37
|
+
render: render
|
|
38
|
+
}))
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_defineProperty(Item, "defaultProps", {
|
|
45
|
+
depth: 0
|
|
46
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/* eslint-disable react/prop-types */
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import Item from './item';
|
|
7
|
+
import LoaderItem from './loader-item';
|
|
8
|
+
export default class Items extends Component {
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super(...args);
|
|
11
|
+
|
|
12
|
+
_defineProperty(this, "state", {
|
|
13
|
+
isLoaderShown: false
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "handleLoaderComplete", () => {
|
|
17
|
+
this.setState({
|
|
18
|
+
isLoaderShown: false
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getDerivedStateFromProps(nextProps, prevState) {
|
|
24
|
+
if (!nextProps.items && !prevState.isLoaderShown) {
|
|
25
|
+
return {
|
|
26
|
+
isLoaderShown: true
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
renderLoader() {
|
|
34
|
+
const {
|
|
35
|
+
depth,
|
|
36
|
+
items
|
|
37
|
+
} = this.props;
|
|
38
|
+
return /*#__PURE__*/React.createElement(LoaderItem, {
|
|
39
|
+
isCompleting: !!(items && items.length),
|
|
40
|
+
onComplete: this.handleLoaderComplete,
|
|
41
|
+
depth: depth + 1
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
renderItems() {
|
|
46
|
+
const {
|
|
47
|
+
render,
|
|
48
|
+
items,
|
|
49
|
+
depth = 0
|
|
50
|
+
} = this.props;
|
|
51
|
+
return items && items.map((itemData, index) => /*#__PURE__*/React.createElement(Item, {
|
|
52
|
+
data: itemData,
|
|
53
|
+
depth: depth + 1,
|
|
54
|
+
key: itemData && itemData.id || index,
|
|
55
|
+
render: render
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
render() {
|
|
60
|
+
const {
|
|
61
|
+
isLoaderShown
|
|
62
|
+
} = this.state;
|
|
63
|
+
const busyAttrs = isLoaderShown ? {
|
|
64
|
+
'aria-busy': true,
|
|
65
|
+
'aria-live': 'polite'
|
|
66
|
+
} : {};
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
68
|
+
role: "rowgroup"
|
|
69
|
+
}, busyAttrs), isLoaderShown ? this.renderLoader() : this.renderItems());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
_defineProperty(Items, "defaultProps", {
|
|
75
|
+
depth: 0
|
|
76
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable react/prop-types */
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import Spinner from '@atlaskit/spinner';
|
|
8
|
+
import CommonCell from './common-cell';
|
|
9
|
+
import { LoaderItemContainer, TreeRowContainer } from './styled';
|
|
10
|
+
export default class LoaderItem extends Component {
|
|
11
|
+
constructor(...args) {
|
|
12
|
+
super(...args);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "state", {
|
|
15
|
+
phase: 'loading'
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static getDerivedStateFromProps(nextProps, prevState) {
|
|
20
|
+
if (nextProps.isCompleting && prevState.phase === 'loading') {
|
|
21
|
+
return {
|
|
22
|
+
phase: 'complete'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentDidUpdate(prevProps, prevState) {
|
|
30
|
+
if (prevState.phase === 'loading' && this.state.phase === 'complete') {
|
|
31
|
+
if (this.props.onComplete) {
|
|
32
|
+
this.props.onComplete();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
const {
|
|
39
|
+
depth
|
|
40
|
+
} = this.props;
|
|
41
|
+
const {
|
|
42
|
+
phase
|
|
43
|
+
} = this.state;
|
|
44
|
+
return phase === 'loading' ? /*#__PURE__*/React.createElement(TreeRowContainer, null, /*#__PURE__*/React.createElement(CommonCell, {
|
|
45
|
+
style: {
|
|
46
|
+
paddingLeft: 25 * depth,
|
|
47
|
+
width: '100%'
|
|
48
|
+
}
|
|
49
|
+
}, /*#__PURE__*/React.createElement(LoaderItemContainer, {
|
|
50
|
+
isRoot: depth === 1
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
52
|
+
size: "small"
|
|
53
|
+
})))) : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
_defineProperty(LoaderItem, "defaultProps", {
|
|
59
|
+
depth: 1
|
|
60
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
const overflowContainerStyles = css({
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
textOverflow: 'ellipsis',
|
|
8
|
+
whiteSpace: 'nowrap'
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* __Overflow container__
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const OverflowContainer = ({
|
|
15
|
+
isSingleLine,
|
|
16
|
+
...props
|
|
17
|
+
}) => jsx("span", _extends({
|
|
18
|
+
css: isSingleLine && overflowContainerStyles
|
|
19
|
+
}, props));
|
|
20
|
+
|
|
21
|
+
export default OverflowContainer;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
import { N30, N800 } from '@atlaskit/theme/colors';
|
|
6
|
+
export const iconColor = `var(--ds-text-highEmphasis, ${N800})`;
|
|
7
|
+
const treeRowContainerStyles = css({
|
|
8
|
+
display: 'flex',
|
|
9
|
+
borderBottom: `1px solid ${`var(--ds-border-neutral, ${N30})`}`
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* __Tree row container__
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const TreeRowContainer = props => jsx("div", _extends({
|
|
16
|
+
css: treeRowContainerStyles
|
|
17
|
+
}, props));
|
|
18
|
+
const commonChevronContainerStyles = css({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
marginLeft: -25,
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
top: 7,
|
|
23
|
+
alignItems: 'center'
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* __Chevron container__
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export const ChevronContainer = props => jsx("span", _extends({}, props, {
|
|
30
|
+
css: commonChevronContainerStyles
|
|
31
|
+
}));
|
|
32
|
+
const chevronIconContainerStyles = css({
|
|
33
|
+
position: 'relative',
|
|
34
|
+
top: 1
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* __Chevron icon container__
|
|
38
|
+
*
|
|
39
|
+
* A chevron icon container.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export const ChevronIconContainer = props => jsx("span", _extends({}, props, {
|
|
43
|
+
css: chevronIconContainerStyles
|
|
44
|
+
}));
|
|
45
|
+
const loadingItemContainerStyles = css({
|
|
46
|
+
width: '100%',
|
|
47
|
+
paddingTop: 5
|
|
48
|
+
});
|
|
49
|
+
const paddingLeftStyles = css({
|
|
50
|
+
paddingLeft: '50%'
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* __Loader item container__
|
|
54
|
+
*
|
|
55
|
+
* A loader item container.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export const LoaderItemContainer = ({
|
|
59
|
+
isRoot,
|
|
60
|
+
...props
|
|
61
|
+
}) => jsx("span", _extends({
|
|
62
|
+
css: [commonChevronContainerStyles, loadingItemContainerStyles, isRoot && paddingLeftStyles]
|
|
63
|
+
}, props));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/* eslint-disable react/prop-types */
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
export default function withColumnWidth(Cell) {
|
|
8
|
+
var _class, _temp;
|
|
9
|
+
|
|
10
|
+
return _temp = _class = class CellWithColumnWidth extends Component {
|
|
11
|
+
UNSAFE_componentWillMount() {
|
|
12
|
+
this.setColumnWidth(this.props.width);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setColumnWidth(width) {
|
|
16
|
+
if (width !== undefined) {
|
|
17
|
+
this.context.tableTree.setColumnWidth(this.props.columnIndex, width);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
22
|
+
this.setColumnWidth(nextProps.width);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
const {
|
|
27
|
+
width,
|
|
28
|
+
columnIndex,
|
|
29
|
+
...other
|
|
30
|
+
} = this.props;
|
|
31
|
+
const columnWidth = width !== null && width !== undefined ? width : this.context.tableTree.getColumnWidth(columnIndex);
|
|
32
|
+
return /*#__PURE__*/React.createElement(Cell, _extends({
|
|
33
|
+
width: columnWidth
|
|
34
|
+
}, other));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}, _defineProperty(_class, "contextTypes", {
|
|
38
|
+
tableTree: PropTypes.object.isRequired
|
|
39
|
+
}), _temp;
|
|
40
|
+
}
|