@atlaskit/table-tree 9.2.7 → 9.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/components/cell.js +6 -31
- package/dist/cjs/components/header.js +0 -21
- package/dist/cjs/components/headers.js +0 -16
- package/dist/cjs/components/internal/chevron.js +4 -31
- package/dist/cjs/components/internal/common-cell.js +2 -11
- package/dist/cjs/components/internal/item.js +5 -25
- package/dist/cjs/components/internal/items.js +6 -32
- package/dist/cjs/components/internal/loader-item.js +0 -26
- package/dist/cjs/components/internal/overflow-container.js +4 -9
- package/dist/cjs/components/internal/styled.js +13 -20
- package/dist/cjs/components/internal/with-column-width.js +3 -25
- package/dist/cjs/components/row.js +7 -46
- package/dist/cjs/components/rows.js +2 -20
- package/dist/cjs/components/table-tree.js +10 -45
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/utils/table-tree-data-helper.js +20 -50
- package/dist/cjs/utils/to-item-id.js +0 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/cell.js +0 -3
- package/dist/es2019/components/header.js +0 -4
- package/dist/es2019/components/headers.js +0 -2
- package/dist/es2019/components/internal/chevron.js +0 -6
- package/dist/es2019/components/internal/common-cell.js +1 -3
- package/dist/es2019/components/internal/item.js +0 -6
- package/dist/es2019/components/internal/items.js +0 -10
- package/dist/es2019/components/internal/loader-item.js +0 -8
- package/dist/es2019/components/internal/overflow-container.js +4 -4
- package/dist/es2019/components/internal/styled.js +13 -10
- package/dist/es2019/components/internal/with-column-width.js +0 -6
- package/dist/es2019/components/row.js +1 -19
- package/dist/es2019/components/rows.js +0 -1
- package/dist/es2019/components/table-tree.js +2 -14
- package/dist/es2019/utils/table-tree-data-helper.js +9 -19
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/cell.js +6 -17
- package/dist/esm/components/header.js +0 -10
- package/dist/esm/components/headers.js +0 -11
- package/dist/esm/components/internal/chevron.js +4 -20
- package/dist/esm/components/internal/common-cell.js +3 -6
- package/dist/esm/components/internal/item.js +5 -19
- package/dist/esm/components/internal/items.js +6 -23
- package/dist/esm/components/internal/loader-item.js +0 -16
- package/dist/esm/components/internal/overflow-container.js +5 -6
- package/dist/esm/components/internal/styled.js +14 -12
- package/dist/esm/components/internal/with-column-width.js +3 -13
- package/dist/esm/components/row.js +7 -31
- package/dist/esm/components/rows.js +2 -12
- package/dist/esm/components/table-tree.js +10 -32
- package/dist/esm/utils/table-tree-data-helper.js +20 -48
- package/dist/esm/version.json +1 -1
- package/package.json +5 -4
- package/report.api.md +14 -1
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
|
|
18
12
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
19
|
-
|
|
20
13
|
var _set = _interopRequireDefault(require("lodash/set"));
|
|
21
|
-
|
|
22
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
-
|
|
26
16
|
function updateRootItems(rootItems) {
|
|
27
17
|
var allItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
28
|
-
|
|
29
18
|
var _ref = arguments.length > 2 ? arguments[2] : undefined,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
key = _ref.key,
|
|
20
|
+
keysCache = _ref.keysCache,
|
|
21
|
+
operation = _ref.operation;
|
|
22
|
+
var newKeysCache = _objectSpread({}, keysCache);
|
|
23
|
+
// If it is not an append operation we can ignore allItems as they will be swaped with new items
|
|
37
24
|
var allBaseItems = operation === 'UPDATE' ? [] : (0, _toConsumableArray2.default)(allItems);
|
|
38
25
|
var startIndexWith = allBaseItems.length;
|
|
39
26
|
rootItems.forEach(function (rootItem, index) {
|
|
40
27
|
var rootItemKey = rootItem[key];
|
|
41
|
-
|
|
42
28
|
if (rootItemKey === undefined) {
|
|
43
29
|
throw new Error("[ERROR] Property '".concat(key, "' not found in rootItem[").concat(index, "]"));
|
|
44
30
|
} else {
|
|
@@ -50,26 +36,22 @@ function updateRootItems(rootItems) {
|
|
|
50
36
|
items: allBaseItems.concat(rootItems)
|
|
51
37
|
};
|
|
52
38
|
}
|
|
53
|
-
|
|
54
39
|
function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
|
|
55
40
|
var key = _ref2.key,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
keysCache = _ref2.keysCache,
|
|
42
|
+
operation = _ref2.operation;
|
|
59
43
|
var newKeysCache = _objectSpread({}, keysCache);
|
|
60
|
-
|
|
61
44
|
var parentCacheKey = itemParent[key];
|
|
62
|
-
|
|
63
45
|
if (parentCacheKey === undefined) {
|
|
64
46
|
throw new Error("[Table Tree] Property '".concat(key, "' not found in parent item"));
|
|
65
47
|
}
|
|
66
|
-
|
|
67
48
|
var parentLocation = newKeysCache[parentCacheKey];
|
|
68
49
|
var allItemsCopy = (0, _toConsumableArray2.default)(allTableItems);
|
|
69
50
|
var objectToChange = (0, _get.default)(allItemsCopy, parentLocation);
|
|
70
51
|
var baseChildrenOfObjectToChange = operation === 'UPDATE' ? [] : (0, _get.default)(objectToChange, 'children', []);
|
|
71
|
-
objectToChange.children = baseChildrenOfObjectToChange.concat(newitems);
|
|
52
|
+
objectToChange.children = baseChildrenOfObjectToChange.concat(newitems);
|
|
72
53
|
|
|
54
|
+
// Update cache
|
|
73
55
|
newitems.forEach(function (item, index) {
|
|
74
56
|
newKeysCache[item[key]] = "".concat(parentLocation, ".children[").concat(index + baseChildrenOfObjectToChange.length, "]");
|
|
75
57
|
});
|
|
@@ -78,6 +60,7 @@ function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
|
|
|
78
60
|
items: (0, _set.default)(allItemsCopy, parentLocation, objectToChange)
|
|
79
61
|
};
|
|
80
62
|
}
|
|
63
|
+
|
|
81
64
|
/**
|
|
82
65
|
* This helper class will create a cache of all the id's in the items object and
|
|
83
66
|
* path to the object.
|
|
@@ -94,19 +77,15 @@ function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
|
|
|
94
77
|
* Cache will look something like:
|
|
95
78
|
* {1: 0, 2: '0.children[0]'}
|
|
96
79
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
80
|
var TableTreeDataHelper = /*#__PURE__*/function () {
|
|
100
81
|
function TableTreeDataHelper() {
|
|
101
82
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
83
|
+
_ref3$key = _ref3.key,
|
|
84
|
+
key = _ref3$key === void 0 ? 'key' : _ref3$key;
|
|
105
85
|
(0, _classCallCheck2.default)(this, TableTreeDataHelper);
|
|
106
86
|
this.key = key;
|
|
107
87
|
this.keysCache = {};
|
|
108
88
|
}
|
|
109
|
-
|
|
110
89
|
(0, _createClass2.default)(TableTreeDataHelper, [{
|
|
111
90
|
key: "updateItems",
|
|
112
91
|
value: function updateItems(items) {
|
|
@@ -117,20 +96,16 @@ var TableTreeDataHelper = /*#__PURE__*/function () {
|
|
|
117
96
|
keysCache: this.keysCache,
|
|
118
97
|
operation: 'UPDATE'
|
|
119
98
|
};
|
|
120
|
-
|
|
121
99
|
if (!parentItem) {
|
|
122
100
|
var _updateRootItems = updateRootItems(items, allItems, options),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
101
|
+
_keysCache = _updateRootItems.keysCache,
|
|
102
|
+
updatedRootItems = _updateRootItems.items;
|
|
126
103
|
this.keysCache = _keysCache;
|
|
127
104
|
return updatedRootItems;
|
|
128
105
|
}
|
|
129
|
-
|
|
130
106
|
var _updateChildItems = updateChildItems(items, allItems, parentItem, options),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
107
|
+
keysCache = _updateChildItems.keysCache,
|
|
108
|
+
updatedItems = _updateChildItems.items;
|
|
134
109
|
this.keysCache = keysCache;
|
|
135
110
|
return updatedItems;
|
|
136
111
|
}
|
|
@@ -144,25 +119,20 @@ var TableTreeDataHelper = /*#__PURE__*/function () {
|
|
|
144
119
|
keysCache: this.keysCache,
|
|
145
120
|
operation: 'APPEND'
|
|
146
121
|
};
|
|
147
|
-
|
|
148
122
|
if (!parentItem) {
|
|
149
123
|
var _updateRootItems2 = updateRootItems(items, allItems, options),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
124
|
+
_keysCache2 = _updateRootItems2.keysCache,
|
|
125
|
+
updatedRootItems = _updateRootItems2.items;
|
|
153
126
|
this.keysCache = _keysCache2;
|
|
154
127
|
return updatedRootItems;
|
|
155
128
|
}
|
|
156
|
-
|
|
157
129
|
var _updateChildItems2 = updateChildItems(items, allItems, parentItem, options),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
130
|
+
keysCache = _updateChildItems2.keysCache,
|
|
131
|
+
updatedItems = _updateChildItems2.items;
|
|
161
132
|
this.keysCache = keysCache;
|
|
162
133
|
return updatedItems;
|
|
163
134
|
}
|
|
164
135
|
}]);
|
|
165
136
|
return TableTreeDataHelper;
|
|
166
137
|
}();
|
|
167
|
-
|
|
168
138
|
exports.default = TableTreeDataHelper;
|
package/dist/cjs/version.json
CHANGED
|
@@ -4,7 +4,6 @@ import CommonCell from './internal/common-cell';
|
|
|
4
4
|
import OverflowContainer from './internal/overflow-container';
|
|
5
5
|
import { indentBase } from './internal/styled';
|
|
6
6
|
import withColumnWidth from './internal/with-column-width';
|
|
7
|
-
|
|
8
7
|
class Cell extends Component {
|
|
9
8
|
render() {
|
|
10
9
|
const {
|
|
@@ -24,7 +23,5 @@ class Cell extends Component {
|
|
|
24
23
|
isSingleLine: singleLine
|
|
25
24
|
}, children));
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
export default withColumnWidth(Cell);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { Component } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -13,7 +12,6 @@ const headerStyles = css({
|
|
|
13
12
|
letterSpacing: -0.1,
|
|
14
13
|
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
15
14
|
});
|
|
16
|
-
|
|
17
15
|
class Header extends Component {
|
|
18
16
|
render() {
|
|
19
17
|
const {
|
|
@@ -27,7 +25,5 @@ class Header extends Component {
|
|
|
27
25
|
}
|
|
28
26
|
}, props), props.children);
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
export default withColumnWidth(Header);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
4
3
|
import { Children, cloneElement, Component } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/react';
|
|
@@ -20,5 +19,4 @@ export default class Headers extends Component {
|
|
|
20
19
|
columnIndex: index
|
|
21
20
|
})));
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
/* eslint-disable @repo/internal/react/consistent-props-definitions */
|
|
5
|
-
|
|
6
4
|
/* eslint-disable react/prop-types */
|
|
7
5
|
import React, { Component } from 'react';
|
|
8
6
|
import Button from '@atlaskit/button';
|
|
@@ -12,14 +10,12 @@ import { ChevronContainer, ChevronIconContainer, iconColor } from './styled';
|
|
|
12
10
|
export default class Chevron extends Component {
|
|
13
11
|
constructor(...args) {
|
|
14
12
|
super(...args);
|
|
15
|
-
|
|
16
13
|
_defineProperty(this, "handleClick", () => {
|
|
17
14
|
if (this.props.onExpandToggle) {
|
|
18
15
|
this.props.onExpandToggle();
|
|
19
16
|
}
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
render() {
|
|
24
20
|
const {
|
|
25
21
|
isExpanded,
|
|
@@ -42,9 +38,7 @@ export default class Chevron extends Component {
|
|
|
42
38
|
label: expandLabel
|
|
43
39
|
}, iconProps)))));
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
_defineProperty(Chevron, "defaultProps", {
|
|
49
43
|
expandLabel: 'Expand',
|
|
50
44
|
collapseLabel: 'Collapse'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
3
|
+
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { N800 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { indentBase } from './styled';
|
|
@@ -14,7 +14,6 @@ const commonStyles = css({
|
|
|
14
14
|
color: `var(--ds-text, ${N800})`,
|
|
15
15
|
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
16
16
|
});
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* __Common cell__
|
|
20
19
|
*/
|
|
@@ -29,5 +28,4 @@ const CommonCell = ({
|
|
|
29
28
|
},
|
|
30
29
|
css: commonStyles
|
|
31
30
|
}));
|
|
32
|
-
|
|
33
31
|
export default CommonCell;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
|
-
|
|
5
3
|
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
6
4
|
import { cloneElement, Component } from 'react';
|
|
7
5
|
import { jsx } from '@emotion/react';
|
|
@@ -16,11 +14,9 @@ export default class Item extends Component {
|
|
|
16
14
|
render
|
|
17
15
|
} = this.props;
|
|
18
16
|
const renderedRow = render(data);
|
|
19
|
-
|
|
20
17
|
if (!renderedRow) {
|
|
21
18
|
return null;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
const {
|
|
25
21
|
itemId,
|
|
26
22
|
items
|
|
@@ -38,9 +34,7 @@ export default class Item extends Component {
|
|
|
38
34
|
}))
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
|
-
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
_defineProperty(Item, "defaultProps", {
|
|
45
39
|
depth: 0
|
|
46
40
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
/* eslint-disable react/prop-types */
|
|
5
4
|
import React, { Component } from 'react';
|
|
6
5
|
import Item from './item';
|
|
@@ -8,28 +7,23 @@ import LoaderItem from './loader-item';
|
|
|
8
7
|
export default class Items extends Component {
|
|
9
8
|
constructor(...args) {
|
|
10
9
|
super(...args);
|
|
11
|
-
|
|
12
10
|
_defineProperty(this, "state", {
|
|
13
11
|
isLoaderShown: false
|
|
14
12
|
});
|
|
15
|
-
|
|
16
13
|
_defineProperty(this, "handleLoaderComplete", () => {
|
|
17
14
|
this.setState({
|
|
18
15
|
isLoaderShown: false
|
|
19
16
|
});
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
24
20
|
if (!nextProps.items && !prevState.isLoaderShown) {
|
|
25
21
|
return {
|
|
26
22
|
isLoaderShown: true
|
|
27
23
|
};
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return null;
|
|
31
26
|
}
|
|
32
|
-
|
|
33
27
|
renderLoader() {
|
|
34
28
|
const {
|
|
35
29
|
depth,
|
|
@@ -41,7 +35,6 @@ export default class Items extends Component {
|
|
|
41
35
|
depth: depth + 1
|
|
42
36
|
});
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
renderItems() {
|
|
46
39
|
const {
|
|
47
40
|
render,
|
|
@@ -55,7 +48,6 @@ export default class Items extends Component {
|
|
|
55
48
|
render: render
|
|
56
49
|
}));
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
render() {
|
|
60
52
|
const {
|
|
61
53
|
isLoaderShown
|
|
@@ -68,9 +60,7 @@ export default class Items extends Component {
|
|
|
68
60
|
role: "rowgroup"
|
|
69
61
|
}, busyAttrs), isLoaderShown ? this.renderLoader() : this.renderItems());
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
}
|
|
73
|
-
|
|
74
64
|
_defineProperty(Items, "defaultProps", {
|
|
75
65
|
depth: 0
|
|
76
66
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
/* eslint-disable react/prop-types */
|
|
4
3
|
import React, { Component } from 'react';
|
|
5
4
|
import Spinner from '@atlaskit/spinner';
|
|
@@ -8,22 +7,18 @@ import { indentBase, LoaderItemContainer, TreeRowContainer } from './styled';
|
|
|
8
7
|
export default class LoaderItem extends Component {
|
|
9
8
|
constructor(...args) {
|
|
10
9
|
super(...args);
|
|
11
|
-
|
|
12
10
|
_defineProperty(this, "state", {
|
|
13
11
|
phase: 'loading'
|
|
14
12
|
});
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
18
15
|
if (nextProps.isCompleting && prevState.phase === 'loading') {
|
|
19
16
|
return {
|
|
20
17
|
phase: 'complete'
|
|
21
18
|
};
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
return null;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
componentDidUpdate(prevProps, prevState) {
|
|
28
23
|
if (prevState.phase === 'loading' && this.state.phase === 'complete') {
|
|
29
24
|
if (this.props.onComplete) {
|
|
@@ -31,7 +26,6 @@ export default class LoaderItem extends Component {
|
|
|
31
26
|
}
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
render() {
|
|
36
30
|
const {
|
|
37
31
|
depth
|
|
@@ -49,9 +43,7 @@ export default class LoaderItem extends Component {
|
|
|
49
43
|
testId: "table-tree-spinner"
|
|
50
44
|
})))) : null;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
_defineProperty(LoaderItem, "defaultProps", {
|
|
56
48
|
depth: 1
|
|
57
49
|
});
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
3
|
+
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
const overflowContainerStyles = css({
|
|
6
6
|
overflow: 'hidden',
|
|
7
7
|
textOverflow: 'ellipsis',
|
|
8
8
|
whiteSpace: 'nowrap'
|
|
9
9
|
});
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
12
|
* __Overflow container__
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
14
|
const OverflowContainer = ({
|
|
15
15
|
isSingleLine,
|
|
16
16
|
...props
|
|
17
|
-
}) =>
|
|
17
|
+
}) =>
|
|
18
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
18
19
|
jsx("span", _extends({
|
|
19
20
|
css: isSingleLine && overflowContainerStyles
|
|
20
21
|
}, props));
|
|
21
|
-
|
|
22
22
|
export default OverflowContainer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
3
|
+
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { N30, N800 } from '@atlaskit/theme/colors';
|
|
6
6
|
export const iconColor = `var(--ds-text, ${N800})`;
|
|
@@ -9,11 +9,12 @@ const treeRowContainerStyles = css({
|
|
|
9
9
|
display: 'flex',
|
|
10
10
|
borderBottom: `1px solid ${`var(--ds-border, ${N30})`}`
|
|
11
11
|
});
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* __Tree row container__
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
export const TreeRowContainer = props =>
|
|
17
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
17
18
|
jsx("div", _extends({
|
|
18
19
|
css: treeRowContainerStyles
|
|
19
20
|
}, props));
|
|
@@ -25,11 +26,12 @@ const commonChevronContainerStyles = css({
|
|
|
25
26
|
top: 7,
|
|
26
27
|
alignItems: 'center'
|
|
27
28
|
});
|
|
29
|
+
|
|
28
30
|
/**
|
|
29
31
|
* __Chevron container__
|
|
30
32
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
export const ChevronContainer = (props
|
|
34
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
33
35
|
) => jsx("span", _extends({}, props, {
|
|
34
36
|
css: commonChevronContainerStyles
|
|
35
37
|
}));
|
|
@@ -37,13 +39,14 @@ const chevronIconContainerStyles = css({
|
|
|
37
39
|
position: 'relative',
|
|
38
40
|
top: 1
|
|
39
41
|
});
|
|
42
|
+
|
|
40
43
|
/**
|
|
41
44
|
* __Chevron icon container__
|
|
42
45
|
*
|
|
43
46
|
* A chevron icon container.
|
|
44
47
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
export const ChevronIconContainer = (props
|
|
49
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
47
50
|
) => jsx("span", _extends({}, props, {
|
|
48
51
|
css: chevronIconContainerStyles
|
|
49
52
|
}));
|
|
@@ -56,16 +59,16 @@ const paddingLeftStyles = css({
|
|
|
56
59
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
|
|
57
60
|
paddingLeft: '50%'
|
|
58
61
|
});
|
|
62
|
+
|
|
59
63
|
/**
|
|
60
64
|
* __Loader item container__
|
|
61
65
|
*
|
|
62
66
|
* A loader item container.
|
|
63
67
|
*/
|
|
64
|
-
|
|
65
68
|
export const LoaderItemContainer = ({
|
|
66
69
|
isRoot,
|
|
67
70
|
...props
|
|
68
71
|
}) => jsx("span", _extends({
|
|
69
|
-
css: [commonChevronContainerStyles, loadingItemContainerStyles, isRoot && paddingLeftStyles]
|
|
70
|
-
|
|
72
|
+
css: [commonChevronContainerStyles, loadingItemContainerStyles, isRoot && paddingLeftStyles]
|
|
73
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
71
74
|
}, props));
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
/* eslint-disable react/prop-types */
|
|
5
4
|
import React, { Component } from 'react';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
6
|
export default function withColumnWidth(Cell) {
|
|
8
7
|
var _class;
|
|
9
|
-
|
|
10
8
|
return _class = class CellWithColumnWidth extends Component {
|
|
11
9
|
UNSAFE_componentWillMount() {
|
|
12
10
|
this.setColumnWidth(this.props.width);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
setColumnWidth(width) {
|
|
16
13
|
if (width !== undefined) {
|
|
17
14
|
this.context.tableTree.setColumnWidth(this.props.columnIndex, width);
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
22
18
|
this.setColumnWidth(nextProps.width);
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
render() {
|
|
26
21
|
const {
|
|
27
22
|
width,
|
|
@@ -33,7 +28,6 @@ export default function withColumnWidth(Cell) {
|
|
|
33
28
|
width: columnWidth
|
|
34
29
|
}, other));
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
}, _defineProperty(_class, "contextTypes", {
|
|
38
32
|
tableTree: PropTypes.object.isRequired
|
|
39
33
|
}), _class;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
5
4
|
import React, { Component, Fragment } from 'react';
|
|
6
5
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -8,21 +7,17 @@ import toItemId from '../utils/to-item-id';
|
|
|
8
7
|
import Chevron from './internal/chevron';
|
|
9
8
|
import { TreeRowContainer } from './internal/styled';
|
|
10
9
|
const packageName = "@atlaskit/table-tree";
|
|
11
|
-
const packageVersion = "9.2.
|
|
12
|
-
|
|
10
|
+
const packageVersion = "9.2.9";
|
|
13
11
|
class Row extends Component {
|
|
14
12
|
constructor(...args) {
|
|
15
13
|
super(...args);
|
|
16
|
-
|
|
17
14
|
_defineProperty(this, "state", {
|
|
18
15
|
isExpanded: this.props.isDefaultExpanded || false
|
|
19
16
|
});
|
|
20
|
-
|
|
21
17
|
_defineProperty(this, "onExpandToggle", () => {
|
|
22
18
|
const {
|
|
23
19
|
isExpanded
|
|
24
20
|
} = this.props;
|
|
25
|
-
|
|
26
21
|
if (isExpanded !== undefined) {
|
|
27
22
|
this.onExpandStateChange(!isExpanded);
|
|
28
23
|
} else {
|
|
@@ -33,13 +28,11 @@ class Row extends Component {
|
|
|
33
28
|
}
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
componentDidUpdate(prevProps) {
|
|
38
32
|
const {
|
|
39
33
|
isDefaultExpanded,
|
|
40
34
|
isExpanded
|
|
41
35
|
} = this.props;
|
|
42
|
-
|
|
43
36
|
if (isExpanded === undefined && isDefaultExpanded !== undefined && prevProps.isDefaultExpanded !== isDefaultExpanded && this.state.isExpanded !== isDefaultExpanded) {
|
|
44
37
|
// eslint-disable-next-line react/no-did-update-set-state
|
|
45
38
|
this.setState({
|
|
@@ -47,7 +40,6 @@ class Row extends Component {
|
|
|
47
40
|
});
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
onExpandStateChange(isExpanded) {
|
|
52
44
|
if (this.props.data) {
|
|
53
45
|
if (isExpanded && this.props.onExpand) {
|
|
@@ -57,14 +49,12 @@ class Row extends Component {
|
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
|
-
|
|
61
52
|
isExpanded() {
|
|
62
53
|
const {
|
|
63
54
|
isExpanded
|
|
64
55
|
} = this.props;
|
|
65
56
|
return isExpanded !== undefined ? isExpanded : this.state.isExpanded;
|
|
66
57
|
}
|
|
67
|
-
|
|
68
58
|
renderCell(cell, cellIndex) {
|
|
69
59
|
const {
|
|
70
60
|
props
|
|
@@ -77,7 +67,6 @@ class Row extends Component {
|
|
|
77
67
|
const isFirstCell = cellIndex === 0;
|
|
78
68
|
const indentLevel = isFirstCell ? depth : 0;
|
|
79
69
|
let cellContent = cell.props.children || [];
|
|
80
|
-
|
|
81
70
|
if (isFirstCell && hasChildren) {
|
|
82
71
|
cellContent = [/*#__PURE__*/React.createElement(Chevron, {
|
|
83
72
|
key: "chevron",
|
|
@@ -88,14 +77,12 @@ class Row extends Component {
|
|
|
88
77
|
ariaControls: toItemId(props.itemId)
|
|
89
78
|
})].concat(cellContent);
|
|
90
79
|
}
|
|
91
|
-
|
|
92
80
|
return /*#__PURE__*/React.cloneElement(cell, {
|
|
93
81
|
key: cellIndex,
|
|
94
82
|
columnIndex: cellIndex,
|
|
95
83
|
indentLevel
|
|
96
84
|
}, cellContent);
|
|
97
85
|
}
|
|
98
|
-
|
|
99
86
|
render() {
|
|
100
87
|
const {
|
|
101
88
|
hasChildren,
|
|
@@ -104,22 +91,17 @@ class Row extends Component {
|
|
|
104
91
|
} = this.props;
|
|
105
92
|
const isExpanded = this.isExpanded();
|
|
106
93
|
const ariaAttrs = {};
|
|
107
|
-
|
|
108
94
|
if (hasChildren) {
|
|
109
95
|
ariaAttrs['aria-expanded'] = isExpanded;
|
|
110
96
|
}
|
|
111
|
-
|
|
112
97
|
if (depth !== undefined) {
|
|
113
98
|
ariaAttrs['aria-level'] = depth;
|
|
114
99
|
}
|
|
115
|
-
|
|
116
100
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TreeRowContainer, _extends({
|
|
117
101
|
role: "row"
|
|
118
102
|
}, ariaAttrs), React.Children.map(this.props.children, (cell, index) => this.renderCell(cell, index))), hasChildren && isExpanded && renderChildren && renderChildren());
|
|
119
103
|
}
|
|
120
|
-
|
|
121
104
|
}
|
|
122
|
-
|
|
123
105
|
export { Row as RowWithoutAnalytics };
|
|
124
106
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
125
107
|
export default withAnalyticsContext({
|