@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
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
5
|
+
import React, { Component, Fragment } from 'react';
|
|
6
|
+
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
+
import toItemId from '../utils/to-item-id';
|
|
8
|
+
import Chevron from './internal/chevron';
|
|
9
|
+
import { TreeRowContainer } from './internal/styled';
|
|
10
|
+
const packageName = "@atlaskit/table-tree";
|
|
11
|
+
const packageVersion = "9.0.13";
|
|
12
|
+
|
|
13
|
+
class Row extends Component {
|
|
14
|
+
constructor(...args) {
|
|
15
|
+
super(...args);
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "state", {
|
|
18
|
+
isExpanded: this.props.isDefaultExpanded || false
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "onExpandToggle", () => {
|
|
22
|
+
const {
|
|
23
|
+
isExpanded
|
|
24
|
+
} = this.props;
|
|
25
|
+
|
|
26
|
+
if (isExpanded !== undefined) {
|
|
27
|
+
this.onExpandStateChange(!isExpanded);
|
|
28
|
+
} else {
|
|
29
|
+
this.setState({
|
|
30
|
+
isExpanded: !this.state.isExpanded
|
|
31
|
+
});
|
|
32
|
+
this.onExpandStateChange(!this.state.isExpanded);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
componentDidUpdate(prevProps) {
|
|
38
|
+
const {
|
|
39
|
+
isDefaultExpanded,
|
|
40
|
+
isExpanded
|
|
41
|
+
} = this.props;
|
|
42
|
+
|
|
43
|
+
if (isExpanded === undefined && isDefaultExpanded !== undefined && prevProps.isDefaultExpanded !== isDefaultExpanded && this.state.isExpanded !== isDefaultExpanded) {
|
|
44
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
45
|
+
this.setState({
|
|
46
|
+
isExpanded: isDefaultExpanded
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onExpandStateChange(isExpanded) {
|
|
52
|
+
if (this.props.data) {
|
|
53
|
+
if (isExpanded && this.props.onExpand) {
|
|
54
|
+
this.props.onExpand(this.props.data);
|
|
55
|
+
} else if (!isExpanded && this.props.onCollapse) {
|
|
56
|
+
this.props.onCollapse(this.props.data);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
isExpanded() {
|
|
62
|
+
const {
|
|
63
|
+
isExpanded
|
|
64
|
+
} = this.props;
|
|
65
|
+
return isExpanded !== undefined ? isExpanded : this.state.isExpanded;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
renderCell(cell, cellIndex) {
|
|
69
|
+
const {
|
|
70
|
+
props
|
|
71
|
+
} = this;
|
|
72
|
+
const isExpanded = this.isExpanded();
|
|
73
|
+
const {
|
|
74
|
+
hasChildren,
|
|
75
|
+
depth
|
|
76
|
+
} = props;
|
|
77
|
+
const isFirstCell = cellIndex === 0;
|
|
78
|
+
const indentLevel = isFirstCell ? depth : 0;
|
|
79
|
+
let cellContent = cell.props.children || [];
|
|
80
|
+
|
|
81
|
+
if (isFirstCell && hasChildren) {
|
|
82
|
+
cellContent = [/*#__PURE__*/React.createElement(Chevron, {
|
|
83
|
+
key: "chevron",
|
|
84
|
+
expandLabel: props.expandLabel,
|
|
85
|
+
collapseLabel: props.collapseLabel,
|
|
86
|
+
isExpanded: isExpanded,
|
|
87
|
+
onExpandToggle: this.onExpandToggle,
|
|
88
|
+
ariaControls: toItemId(props.itemId)
|
|
89
|
+
})].concat(cellContent);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return /*#__PURE__*/React.cloneElement(cell, {
|
|
93
|
+
key: cellIndex,
|
|
94
|
+
columnIndex: cellIndex,
|
|
95
|
+
indentLevel
|
|
96
|
+
}, cellContent);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
render() {
|
|
100
|
+
const {
|
|
101
|
+
hasChildren,
|
|
102
|
+
depth,
|
|
103
|
+
renderChildren
|
|
104
|
+
} = this.props;
|
|
105
|
+
const isExpanded = this.isExpanded();
|
|
106
|
+
const ariaAttrs = {};
|
|
107
|
+
|
|
108
|
+
if (hasChildren) {
|
|
109
|
+
ariaAttrs['aria-expanded'] = isExpanded;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (depth !== undefined) {
|
|
113
|
+
ariaAttrs['aria-level'] = depth;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TreeRowContainer, _extends({
|
|
117
|
+
role: "row"
|
|
118
|
+
}, ariaAttrs), React.Children.map(this.props.children, (cell, index) => this.renderCell(cell, index))), hasChildren && isExpanded && renderChildren && renderChildren());
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { Row as RowWithoutAnalytics };
|
|
124
|
+
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
125
|
+
export default withAnalyticsContext({
|
|
126
|
+
componentName: 'row',
|
|
127
|
+
packageName,
|
|
128
|
+
packageVersion
|
|
129
|
+
})(withAnalyticsEvents({
|
|
130
|
+
onExpand: createAndFireEventOnAtlaskit({
|
|
131
|
+
action: 'expanded',
|
|
132
|
+
actionSubject: 'tableTree',
|
|
133
|
+
attributes: {
|
|
134
|
+
componentName: 'row',
|
|
135
|
+
packageName,
|
|
136
|
+
packageVersion
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
onCollapse: createAndFireEventOnAtlaskit({
|
|
140
|
+
action: 'collapsed',
|
|
141
|
+
actionSubject: 'tableTree',
|
|
142
|
+
attributes: {
|
|
143
|
+
componentName: 'row',
|
|
144
|
+
packageName,
|
|
145
|
+
packageVersion
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
})(Row));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import Items from './internal/items';
|
|
3
|
+
export default class Rows extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
const {
|
|
6
|
+
items,
|
|
7
|
+
render
|
|
8
|
+
} = this.props;
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Items, {
|
|
10
|
+
items: items,
|
|
11
|
+
render: render
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable react/prop-types */
|
|
4
|
+
import React, { Component } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Cell from './cell';
|
|
7
|
+
import Header from './header';
|
|
8
|
+
import Headers from './headers';
|
|
9
|
+
import Row from './row';
|
|
10
|
+
import Rows from './rows';
|
|
11
|
+
export default class TableTree extends Component {
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "state", {
|
|
16
|
+
columnWidths: []
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "setColumnWidth", (columnIndex, width) => {
|
|
20
|
+
const {
|
|
21
|
+
columnWidths
|
|
22
|
+
} = this.state;
|
|
23
|
+
|
|
24
|
+
if (width === columnWidths[columnIndex]) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
columnWidths[columnIndex] = width;
|
|
29
|
+
this.setState({
|
|
30
|
+
columnWidths
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
_defineProperty(this, "getColumnWidth", columnIndex => {
|
|
35
|
+
return this.state && this.state.columnWidths[columnIndex] || null;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
componentDidMount() {
|
|
40
|
+
const widths = this.props.columnWidths;
|
|
41
|
+
|
|
42
|
+
if (widths) {
|
|
43
|
+
this.setState({
|
|
44
|
+
columnWidths: widths
|
|
45
|
+
}); // eslint-disable-line
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getChildContext() {
|
|
50
|
+
return {
|
|
51
|
+
tableTree: {
|
|
52
|
+
columnWidths: this.state.columnWidths,
|
|
53
|
+
setColumnWidth: this.setColumnWidth,
|
|
54
|
+
getColumnWidth: this.getColumnWidth
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
render() {
|
|
60
|
+
const {
|
|
61
|
+
items,
|
|
62
|
+
headers,
|
|
63
|
+
columns,
|
|
64
|
+
columnWidths = []
|
|
65
|
+
} = this.props;
|
|
66
|
+
const heads = headers && /*#__PURE__*/React.createElement(Headers, null, headers.map((header, index) =>
|
|
67
|
+
/*#__PURE__*/
|
|
68
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
69
|
+
React.createElement(Header, {
|
|
70
|
+
key: index,
|
|
71
|
+
columnIndex: index,
|
|
72
|
+
width: columnWidths[index]
|
|
73
|
+
}, header)));
|
|
74
|
+
let rows = null;
|
|
75
|
+
|
|
76
|
+
if (columns && items) {
|
|
77
|
+
rows = /*#__PURE__*/React.createElement(Rows, {
|
|
78
|
+
items: items,
|
|
79
|
+
render: ({
|
|
80
|
+
id,
|
|
81
|
+
children,
|
|
82
|
+
hasChildren,
|
|
83
|
+
content
|
|
84
|
+
}) => /*#__PURE__*/React.createElement(Row, {
|
|
85
|
+
itemId: id,
|
|
86
|
+
items: children,
|
|
87
|
+
hasChildren: hasChildren
|
|
88
|
+
}, columns.map((CellContent, index) => /*#__PURE__*/React.createElement(Cell // eslint-disable-next-line react/no-array-index-key
|
|
89
|
+
, {
|
|
90
|
+
key: index,
|
|
91
|
+
columnIndex: index,
|
|
92
|
+
width: columnWidths[index]
|
|
93
|
+
}, /*#__PURE__*/React.createElement(CellContent, content))))
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
role: "treegrid",
|
|
99
|
+
"aria-readonly": true
|
|
100
|
+
}, heads, rows, this.props.children);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_defineProperty(TableTree, "childContextTypes", {
|
|
106
|
+
tableTree: PropTypes.object.isRequired
|
|
107
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default } from './components/table-tree';
|
|
2
|
+
export { default as Headers } from './components/headers';
|
|
3
|
+
export { default as Header } from './components/header';
|
|
4
|
+
export { default as Cell } from './components/cell';
|
|
5
|
+
export { default as Rows } from './components/rows';
|
|
6
|
+
export { default as Row } from './components/row';
|
|
7
|
+
export { default as TableTreeDataHelper } from './utils/table-tree-data-helper';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
import set from 'lodash/set';
|
|
3
|
+
|
|
4
|
+
function updateRootItems(rootItems, allItems = [], {
|
|
5
|
+
key,
|
|
6
|
+
keysCache,
|
|
7
|
+
operation
|
|
8
|
+
}) {
|
|
9
|
+
const newKeysCache = { ...keysCache
|
|
10
|
+
}; // If it is not an append operation we can ignore allItems as they will be swaped with new items
|
|
11
|
+
|
|
12
|
+
const allBaseItems = operation === 'UPDATE' ? [] : [...allItems];
|
|
13
|
+
const startIndexWith = allBaseItems.length;
|
|
14
|
+
rootItems.forEach((rootItem, index) => {
|
|
15
|
+
const rootItemKey = rootItem[key];
|
|
16
|
+
|
|
17
|
+
if (rootItemKey === undefined) {
|
|
18
|
+
throw new Error(`[ERROR] Property '${key}' not found in rootItem[${index}]`);
|
|
19
|
+
} else {
|
|
20
|
+
newKeysCache[rootItem[key]] = index + startIndexWith;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
keysCache: newKeysCache,
|
|
25
|
+
items: allBaseItems.concat(rootItems)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function updateChildItems(newitems, allTableItems, itemParent, {
|
|
30
|
+
key,
|
|
31
|
+
keysCache,
|
|
32
|
+
operation
|
|
33
|
+
}) {
|
|
34
|
+
const newKeysCache = { ...keysCache
|
|
35
|
+
};
|
|
36
|
+
const parentCacheKey = itemParent[key];
|
|
37
|
+
|
|
38
|
+
if (parentCacheKey === undefined) {
|
|
39
|
+
throw new Error(`[Table Tree] Property '${key}' not found in parent item`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const parentLocation = newKeysCache[parentCacheKey];
|
|
43
|
+
const allItemsCopy = [...allTableItems];
|
|
44
|
+
const objectToChange = get(allItemsCopy, parentLocation);
|
|
45
|
+
const baseChildrenOfObjectToChange = operation === 'UPDATE' ? [] : get(objectToChange, 'children', []);
|
|
46
|
+
objectToChange.children = baseChildrenOfObjectToChange.concat(newitems); // Update cache
|
|
47
|
+
|
|
48
|
+
newitems.forEach((item, index) => {
|
|
49
|
+
newKeysCache[item[key]] = `${parentLocation}.children[${index + baseChildrenOfObjectToChange.length}]`;
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
keysCache: newKeysCache,
|
|
53
|
+
items: set(allItemsCopy, parentLocation, objectToChange)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* This helper class will create a cache of all the id's in the items object and
|
|
58
|
+
* path to the object.
|
|
59
|
+
* Example:
|
|
60
|
+
* [{
|
|
61
|
+
* // item 1,
|
|
62
|
+
* id: 1,
|
|
63
|
+
* children:[{
|
|
64
|
+
* // item 1.1,
|
|
65
|
+
* id: '2'
|
|
66
|
+
* }]
|
|
67
|
+
* }]
|
|
68
|
+
*
|
|
69
|
+
* Cache will look something like:
|
|
70
|
+
* {1: 0, 2: '0.children[0]'}
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export default class TableTreeDataHelper {
|
|
75
|
+
constructor({
|
|
76
|
+
key = 'key'
|
|
77
|
+
} = {}) {
|
|
78
|
+
this.key = key;
|
|
79
|
+
this.keysCache = {};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
updateItems(items, allItems = [], parentItem) {
|
|
83
|
+
const options = {
|
|
84
|
+
key: this.key,
|
|
85
|
+
keysCache: this.keysCache,
|
|
86
|
+
operation: 'UPDATE'
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (!parentItem) {
|
|
90
|
+
const {
|
|
91
|
+
keysCache,
|
|
92
|
+
items: updatedRootItems
|
|
93
|
+
} = updateRootItems(items, allItems, options);
|
|
94
|
+
this.keysCache = keysCache;
|
|
95
|
+
return updatedRootItems;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const {
|
|
99
|
+
keysCache,
|
|
100
|
+
items: updatedItems
|
|
101
|
+
} = updateChildItems(items, allItems, parentItem, options);
|
|
102
|
+
this.keysCache = keysCache;
|
|
103
|
+
return updatedItems;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
appendItems(items, allItems = [], parentItem) {
|
|
107
|
+
const options = {
|
|
108
|
+
key: this.key,
|
|
109
|
+
keysCache: this.keysCache,
|
|
110
|
+
operation: 'APPEND'
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (!parentItem) {
|
|
114
|
+
const {
|
|
115
|
+
keysCache,
|
|
116
|
+
items: updatedRootItems
|
|
117
|
+
} = updateRootItems(items, allItems, options);
|
|
118
|
+
this.keysCache = keysCache;
|
|
119
|
+
return updatedRootItems;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const {
|
|
123
|
+
keysCache,
|
|
124
|
+
items: updatedItems
|
|
125
|
+
} = updateChildItems(items, allItems, parentItem, options);
|
|
126
|
+
this.keysCache = keysCache;
|
|
127
|
+
return updatedItems;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
@@ -10,8 +11,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
11
|
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
12
|
|
|
12
13
|
import React, { Component } from 'react';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
14
|
+
import CommonCell from './internal/common-cell';
|
|
15
|
+
import OverflowContainer from './internal/overflow-container';
|
|
16
|
+
import withColumnWidth from './internal/with-column-width';
|
|
15
17
|
|
|
16
18
|
var Cell = /*#__PURE__*/function (_Component) {
|
|
17
19
|
_inherits(Cell, _Component);
|
|
@@ -27,12 +29,24 @@ var Cell = /*#__PURE__*/function (_Component) {
|
|
|
27
29
|
_createClass(Cell, [{
|
|
28
30
|
key: "render",
|
|
29
31
|
value: function render() {
|
|
30
|
-
var props = this.props
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
var _this$props = this.props,
|
|
33
|
+
children = _this$props.children,
|
|
34
|
+
singleLine = _this$props.singleLine,
|
|
35
|
+
indentLevel = _this$props.indentLevel,
|
|
36
|
+
width = _this$props.width,
|
|
37
|
+
className = _this$props.className,
|
|
38
|
+
props = _objectWithoutProperties(_this$props, ["children", "singleLine", "indentLevel", "width", "className"]);
|
|
39
|
+
|
|
40
|
+
return /*#__PURE__*/React.createElement(CommonCell, _extends({
|
|
41
|
+
role: "gridcell",
|
|
42
|
+
indent: indentLevel ? "".concat(25 * indentLevel) : undefined,
|
|
43
|
+
style: {
|
|
44
|
+
width: width
|
|
45
|
+
},
|
|
46
|
+
className: className
|
|
33
47
|
}, props), /*#__PURE__*/React.createElement(OverflowContainer, {
|
|
34
|
-
|
|
35
|
-
},
|
|
48
|
+
isSingleLine: singleLine
|
|
49
|
+
}, children));
|
|
36
50
|
}
|
|
37
51
|
}]);
|
|
38
52
|
|
|
@@ -9,9 +9,21 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
|
|
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
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
|
|
14
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
15
|
+
import { Component } from 'react';
|
|
16
|
+
import { css, jsx } from '@emotion/core';
|
|
17
|
+
import { N300 } from '@atlaskit/theme/colors';
|
|
18
|
+
import ColumnCell from './internal/common-cell';
|
|
19
|
+
import withColumnWidth from './internal/with-column-width';
|
|
20
|
+
var headerStyles = css({
|
|
21
|
+
color: "var(--ds-text-mediumEmphasis, ".concat(N300, ")"),
|
|
22
|
+
fontSize: 12,
|
|
23
|
+
fontWeight: 'bold',
|
|
24
|
+
letterSpacing: -0.1,
|
|
25
|
+
lineHeight: '1.67'
|
|
26
|
+
});
|
|
15
27
|
|
|
16
28
|
var Header = /*#__PURE__*/function (_Component) {
|
|
17
29
|
_inherits(Header, _Component);
|
|
@@ -28,8 +40,12 @@ var Header = /*#__PURE__*/function (_Component) {
|
|
|
28
40
|
key: "render",
|
|
29
41
|
value: function render() {
|
|
30
42
|
var props = this.props;
|
|
31
|
-
return
|
|
32
|
-
|
|
43
|
+
return jsx(ColumnCell, _extends({
|
|
44
|
+
css: headerStyles,
|
|
45
|
+
role: "columnheader",
|
|
46
|
+
style: {
|
|
47
|
+
width: props.width
|
|
48
|
+
}
|
|
33
49
|
}, props), props.children);
|
|
34
50
|
}
|
|
35
51
|
}]);
|
|
@@ -8,8 +8,15 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
8
8
|
|
|
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
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/** @jsx jsx */
|
|
12
|
+
|
|
13
|
+
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
14
|
+
import { Children, cloneElement, Component } from 'react';
|
|
15
|
+
import { css, jsx } from '@emotion/core';
|
|
16
|
+
var containerStyles = css({
|
|
17
|
+
display: 'flex',
|
|
18
|
+
borderBottom: "solid 2px ".concat("var(--ds-border-neutral, #dfe1e6)")
|
|
19
|
+
});
|
|
13
20
|
|
|
14
21
|
var Headers = /*#__PURE__*/function (_Component) {
|
|
15
22
|
_inherits(Headers, _Component);
|
|
@@ -25,13 +32,14 @@ var Headers = /*#__PURE__*/function (_Component) {
|
|
|
25
32
|
_createClass(Headers, [{
|
|
26
33
|
key: "render",
|
|
27
34
|
value: function render() {
|
|
28
|
-
return
|
|
35
|
+
return jsx("div", {
|
|
36
|
+
css: containerStyles,
|
|
29
37
|
role: "row"
|
|
30
|
-
},
|
|
38
|
+
}, Children.map(this.props.children, function (header, index) {
|
|
31
39
|
return (
|
|
32
40
|
/*#__PURE__*/
|
|
33
41
|
// eslint-disable-next-line react/no-array-index-key
|
|
34
|
-
|
|
42
|
+
cloneElement(header, {
|
|
35
43
|
key: index,
|
|
36
44
|
columnIndex: index
|
|
37
45
|
})
|
|
@@ -11,12 +11,14 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
|
|
12
12
|
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; } }
|
|
13
13
|
|
|
14
|
+
/* eslint-disable @repo/internal/react/consistent-props-definitions */
|
|
15
|
+
|
|
14
16
|
/* eslint-disable react/prop-types */
|
|
15
17
|
import React, { Component } from 'react';
|
|
16
18
|
import Button from '@atlaskit/button';
|
|
17
19
|
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
18
20
|
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
19
|
-
import { ChevronContainer, ChevronIconContainer, iconColor } from '
|
|
21
|
+
import { ChevronContainer, ChevronIconContainer, iconColor } from './styled';
|
|
20
22
|
|
|
21
23
|
var Chevron = /*#__PURE__*/function (_Component) {
|
|
22
24
|
_inherits(Chevron, _Component);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
|
+
import { N800 } from '@atlaskit/theme/colors';
|
|
7
|
+
var commonStyles = css({
|
|
8
|
+
display: 'flex',
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
minHeight: 40,
|
|
11
|
+
padding: '10px 25px 10px var(--indent, 25px)',
|
|
12
|
+
position: 'relative',
|
|
13
|
+
alignItems: 'flex-start',
|
|
14
|
+
color: "var(--ds-text-highEmphasis, ".concat(N800, ")"),
|
|
15
|
+
lineHeight: '20px'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* __Common cell__
|
|
20
|
+
*/
|
|
21
|
+
var CommonCell = function CommonCell(_ref) {
|
|
22
|
+
var indent = _ref.indent,
|
|
23
|
+
props = _objectWithoutProperties(_ref, ["indent"]);
|
|
24
|
+
|
|
25
|
+
return jsx("div", _extends({
|
|
26
|
+
style: {
|
|
27
|
+
'--indent': indent
|
|
28
|
+
},
|
|
29
|
+
css: commonStyles
|
|
30
|
+
}, props));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default CommonCell;
|
|
@@ -9,9 +9,13 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
|
|
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
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
|
|
14
|
+
/* eslint-disable @repo/internal/react/no-clone-element */
|
|
15
|
+
import { cloneElement, Component } from 'react';
|
|
16
|
+
import { jsx } from '@emotion/core';
|
|
17
|
+
import toItemId from '../../utils/to-item-id';
|
|
18
|
+
import Items from './items';
|
|
15
19
|
|
|
16
20
|
var Item = /*#__PURE__*/function (_Component) {
|
|
17
21
|
_inherits(Item, _Component);
|
|
@@ -41,13 +45,13 @@ var Item = /*#__PURE__*/function (_Component) {
|
|
|
41
45
|
var _renderedRow$props = renderedRow.props,
|
|
42
46
|
itemId = _renderedRow$props.itemId,
|
|
43
47
|
items = _renderedRow$props.items;
|
|
44
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/cloneElement(renderedRow, {
|
|
45
49
|
depth: depth,
|
|
46
50
|
data: data,
|
|
47
51
|
renderChildren: function renderChildren() {
|
|
48
|
-
return
|
|
52
|
+
return jsx("div", {
|
|
49
53
|
id: toItemId(itemId)
|
|
50
|
-
},
|
|
54
|
+
}, jsx(Items, {
|
|
51
55
|
parentData: data,
|
|
52
56
|
depth: depth,
|
|
53
57
|
items: items,
|
|
@@ -13,8 +13,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
13
13
|
|
|
14
14
|
/* eslint-disable react/prop-types */
|
|
15
15
|
import React, { Component } from 'react';
|
|
16
|
-
import Item from './
|
|
17
|
-
import LoaderItem from './
|
|
16
|
+
import Item from './item';
|
|
17
|
+
import LoaderItem from './loader-item';
|
|
18
18
|
|
|
19
19
|
var Items = /*#__PURE__*/function (_Component) {
|
|
20
20
|
_inherits(Items, _Component);
|