orcs-design-system 3.2.4 → 3.2.6
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/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- package/package.json +29 -38
|
@@ -3,44 +3,47 @@ import Table from ".";
|
|
|
3
3
|
import Card from "../Card/index";
|
|
4
4
|
import Box from "../Box";
|
|
5
5
|
import Badge from "../Badge";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
export default {
|
|
7
8
|
title: "Components/Table",
|
|
8
9
|
component: Table
|
|
9
10
|
};
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, []);
|
|
38
|
-
return /*#__PURE__*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
11
|
+
export const Default = () => {
|
|
12
|
+
const columns = useMemo(() => [{
|
|
13
|
+
accessorKey: "name",
|
|
14
|
+
header: "Name",
|
|
15
|
+
enableHiding: false
|
|
16
|
+
}, {
|
|
17
|
+
accessorFn: originalRow => parseInt(originalRow.age),
|
|
18
|
+
id: "age",
|
|
19
|
+
header: "Age",
|
|
20
|
+
Header: /*#__PURE__*/_jsx("i", {
|
|
21
|
+
children: "Age"
|
|
22
|
+
}),
|
|
23
|
+
Cell: _ref => {
|
|
24
|
+
let {
|
|
25
|
+
cell
|
|
26
|
+
} = _ref;
|
|
27
|
+
return /*#__PURE__*/_jsx("i", {
|
|
28
|
+
children: cell.getValue().toLocaleString()
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}], []);
|
|
32
|
+
const data = useMemo(() => [{
|
|
33
|
+
name: "John",
|
|
34
|
+
age: 30
|
|
35
|
+
}, {
|
|
36
|
+
name: "Sara",
|
|
37
|
+
age: 25
|
|
38
|
+
}], []);
|
|
39
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
40
|
+
children: /*#__PURE__*/_jsx(Table, {
|
|
41
|
+
columns: columns,
|
|
42
|
+
data: data
|
|
43
|
+
})
|
|
44
|
+
});
|
|
42
45
|
};
|
|
43
|
-
|
|
46
|
+
const types = {
|
|
44
47
|
strat_outcome: {
|
|
45
48
|
variant: "primaryDark",
|
|
46
49
|
label: "Strategic Outcome"
|
|
@@ -58,95 +61,98 @@ var types = {
|
|
|
58
61
|
label: "Work Item"
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
64
|
+
export const NestedTreeStructure = () => {
|
|
65
|
+
const columns = useMemo(() => [{
|
|
66
|
+
accessorKey: "name",
|
|
67
|
+
id: "name",
|
|
68
|
+
header: "Strategy"
|
|
69
|
+
}, {
|
|
70
|
+
accessorKey: "workForce",
|
|
71
|
+
id: "workForce",
|
|
72
|
+
header: "Work force"
|
|
73
|
+
}, {
|
|
74
|
+
accessorKey: "type",
|
|
75
|
+
id: "type",
|
|
76
|
+
header: "Type",
|
|
77
|
+
Cell: _ref2 => {
|
|
78
|
+
let {
|
|
79
|
+
cell
|
|
80
|
+
} = _ref2;
|
|
81
|
+
const type = types[cell.getValue()];
|
|
82
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
83
|
+
children: /*#__PURE__*/_jsx(Badge, {
|
|
84
|
+
variant: type === null || type === void 0 ? void 0 : type.variant,
|
|
85
|
+
children: type === null || type === void 0 ? void 0 : type.label
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}], []);
|
|
90
|
+
const data = useMemo(() => [{
|
|
91
|
+
name: "Never gonna give you up",
|
|
92
|
+
workForce: 391,
|
|
93
|
+
type: "strat_outcome",
|
|
94
|
+
children: [{
|
|
95
|
+
name: "Never gonna let you down",
|
|
96
|
+
workForce: 25,
|
|
97
|
+
type: "okr",
|
|
89
98
|
children: [{
|
|
90
|
-
name: "Never gonna
|
|
91
|
-
workForce:
|
|
92
|
-
type: "
|
|
99
|
+
name: "TPP-441 Never gonna run around and desert you",
|
|
100
|
+
workForce: 30,
|
|
101
|
+
type: "epic",
|
|
93
102
|
children: [{
|
|
94
|
-
name: "TPP-
|
|
95
|
-
workForce:
|
|
96
|
-
type: "
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, {
|
|
106
|
-
name: "TPP-685 Never gonna tell a lie and hurt you",
|
|
107
|
-
workForce: 25,
|
|
108
|
-
type: "work_item"
|
|
109
|
-
}]
|
|
103
|
+
name: "TPP-684 Never gonna make you cry",
|
|
104
|
+
workForce: 25,
|
|
105
|
+
type: "work_item"
|
|
106
|
+
}, {
|
|
107
|
+
name: "TPP-685 Never gonna say goodbye",
|
|
108
|
+
workForce: 25,
|
|
109
|
+
type: "work_item"
|
|
110
|
+
}, {
|
|
111
|
+
name: "TPP-685 Never gonna tell a lie and hurt you",
|
|
112
|
+
workForce: 25,
|
|
113
|
+
type: "work_item"
|
|
110
114
|
}]
|
|
111
115
|
}]
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
}]
|
|
117
|
+
}, {
|
|
118
|
+
name: "Grow customer base by 5 mill",
|
|
119
|
+
workForce: 391,
|
|
120
|
+
type: "strat_outcome",
|
|
121
|
+
children: [{
|
|
122
|
+
name: "Launch our revolutionary HPLSF module",
|
|
123
|
+
workForce: 25,
|
|
124
|
+
type: "okr",
|
|
116
125
|
children: [{
|
|
117
|
-
name: "
|
|
118
|
-
workForce:
|
|
119
|
-
type: "
|
|
126
|
+
name: "TPP-441 New space flight model test",
|
|
127
|
+
workForce: 30,
|
|
128
|
+
type: "epic",
|
|
120
129
|
children: [{
|
|
121
|
-
name: "TPP-
|
|
122
|
-
workForce:
|
|
123
|
-
type: "
|
|
124
|
-
children: [{
|
|
125
|
-
name: "TPP-684 Infra benchmarking",
|
|
126
|
-
workForce: 25,
|
|
127
|
-
type: "work_item"
|
|
128
|
-
}]
|
|
130
|
+
name: "TPP-684 Infra benchmarking",
|
|
131
|
+
workForce: 25,
|
|
132
|
+
type: "work_item"
|
|
129
133
|
}]
|
|
130
134
|
}]
|
|
131
|
-
}]
|
|
132
|
-
}, []);
|
|
133
|
-
return /*#__PURE__*/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
}]
|
|
136
|
+
}], []);
|
|
137
|
+
return /*#__PURE__*/_jsx(Card, {
|
|
138
|
+
children: /*#__PURE__*/_jsx(Table, {
|
|
139
|
+
columns: columns,
|
|
140
|
+
data: data,
|
|
141
|
+
enableExpanding: true,
|
|
142
|
+
enableExpandAll: true,
|
|
143
|
+
muiTableBodyCellProps: _ref3 => {
|
|
144
|
+
let {
|
|
145
|
+
row
|
|
146
|
+
} = _ref3;
|
|
147
|
+
return {
|
|
148
|
+
sx: () => ({
|
|
143
149
|
color: row.original.type === "work_item" ? "grey" : "",
|
|
144
150
|
fontWeight: row.depth === 0 ? 600 : row.depth === 1 ? 500 : undefined
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
})
|
|
151
|
+
})
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
});
|
|
150
156
|
};
|
|
151
157
|
Default.__docgenInfo = {
|
|
152
158
|
"description": "",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import { Stack } from "@mui/material";
|
|
3
2
|
import { MRT_ExpandAllButton } from "material-react-table";
|
|
4
3
|
import React from "react";
|
|
@@ -6,84 +5,90 @@ import Box from "../Box";
|
|
|
6
5
|
import { get } from "lodash";
|
|
7
6
|
import styled from "styled-components";
|
|
8
7
|
import { PropTypes } from "prop-types";
|
|
9
|
-
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const StyledHighlight = styled.span.withConfig({
|
|
10
10
|
displayName: "getExpandColumnConfig__StyledHighlight",
|
|
11
11
|
componentId: "sc-kekww4-0"
|
|
12
|
-
})(["background-color:", ";border-radius:2px;padding:2px 1px;"],
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return value.split(regex).map(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, part) : part;
|
|
25
|
-
});
|
|
12
|
+
})(["background-color:", ";border-radius:2px;padding:2px 1px;"], props => props.matchHighlightColor);
|
|
13
|
+
const getHiglightedSearchTerm = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
value,
|
|
16
|
+
searchTerm,
|
|
17
|
+
matchHighlightColor
|
|
18
|
+
} = _ref;
|
|
19
|
+
const regex = new RegExp("(".concat(searchTerm, ")"), "i");
|
|
20
|
+
return value.split(regex).map((part, i) => part.match(regex) ? /*#__PURE__*/_jsx(StyledHighlight, {
|
|
21
|
+
matchHighlightColor: matchHighlightColor,
|
|
22
|
+
children: part
|
|
23
|
+
}, part + i) : part);
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const GroupedCell = props => {
|
|
26
|
+
const {
|
|
27
|
+
row,
|
|
28
|
+
table,
|
|
29
|
+
firstCol
|
|
30
|
+
} = props;
|
|
31
|
+
const {
|
|
32
|
+
mrtTheme: {
|
|
33
|
+
matchHighlightColor
|
|
34
|
+
},
|
|
35
|
+
enableFilterMatchHighlighting
|
|
36
|
+
} = (table === null || table === void 0 ? void 0 : table.options) || {};
|
|
37
|
+
const searchTerm = table.getState().globalFilter;
|
|
38
|
+
const value = get(row.original, firstCol.accessorKey);
|
|
39
|
+
let renderedCellValue = value;
|
|
37
40
|
if (enableFilterMatchHighlighting && searchTerm) {
|
|
38
41
|
renderedCellValue = getHiglightedSearchTerm({
|
|
39
|
-
value
|
|
40
|
-
searchTerm
|
|
41
|
-
matchHighlightColor
|
|
42
|
+
value,
|
|
43
|
+
searchTerm,
|
|
44
|
+
matchHighlightColor
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
if (firstCol.Cell) {
|
|
45
|
-
return /*#__PURE__*/
|
|
48
|
+
return /*#__PURE__*/_jsx(firstCol.Cell, {
|
|
49
|
+
...props,
|
|
46
50
|
renderedCellValue: renderedCellValue
|
|
47
|
-
})
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
53
|
return renderedCellValue;
|
|
50
54
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
GroupedCell.propTypes = PropTypes.Obj;
|
|
56
|
+
const HeaderCell = props => {
|
|
57
|
+
const {
|
|
58
|
+
table,
|
|
59
|
+
firstCol,
|
|
60
|
+
tableConfig
|
|
61
|
+
} = props;
|
|
62
|
+
let headerMarkup = firstCol.header;
|
|
57
63
|
if ( /*#__PURE__*/React.isValidElement(firstCol.Header)) {
|
|
58
64
|
headerMarkup = firstCol.Header;
|
|
59
65
|
}
|
|
60
66
|
if (typeof firstCol.Header === "function") {
|
|
61
|
-
headerMarkup = /*#__PURE__*/
|
|
67
|
+
headerMarkup = /*#__PURE__*/_jsx(firstCol.Header, {});
|
|
62
68
|
}
|
|
63
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
64
70
|
direction: "row",
|
|
65
|
-
alignItems: "center"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
children: [tableConfig.enableExpandAll && /*#__PURE__*/_jsx(MRT_ExpandAllButton, {
|
|
73
|
+
table: table
|
|
74
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
75
|
+
children: headerMarkup
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
69
78
|
};
|
|
70
79
|
HeaderCell.propTypes = PropTypes.Obj;
|
|
71
|
-
export default (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
size: 200
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
});
|
|
80
|
+
export default ((firstCol, tableConfig) => ({
|
|
81
|
+
"mrt-row-expand": {
|
|
82
|
+
Header: props => /*#__PURE__*/_jsx(HeaderCell, {
|
|
83
|
+
...props,
|
|
84
|
+
firstCol: firstCol,
|
|
85
|
+
tableConfig: tableConfig
|
|
86
|
+
}),
|
|
87
|
+
GroupedCell: props => /*#__PURE__*/_jsx(GroupedCell, {
|
|
88
|
+
...props,
|
|
89
|
+
firstCol: firstCol
|
|
90
|
+
}),
|
|
91
|
+
enableResizing: true,
|
|
92
|
+
size: 200
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["data", "columns"];
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
1
|
import React, { useCallback, useMemo } from "react";
|
|
7
2
|
import { useMaterialReactTable, MaterialReactTable } from "material-react-table";
|
|
8
3
|
import { merge } from "lodash";
|
|
9
4
|
import muiStyleOverrides from "./muiStyleOverrides";
|
|
10
5
|
import getExpandColumnConfig from "./getExpandColumnConfig";
|
|
11
6
|
import { PropTypes } from "prop-types";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const Table = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
data,
|
|
11
|
+
columns,
|
|
12
|
+
...tableConfig
|
|
13
|
+
} = _ref;
|
|
14
|
+
const otherConfig = {};
|
|
15
|
+
const columnVisibility = {};
|
|
16
|
+
const firstCol = useMemo(() => columns[0], [columns]);
|
|
21
17
|
if (tableConfig.enableExpanding) {
|
|
22
18
|
columnVisibility[firstCol.id] = false;
|
|
23
19
|
columns[0].visibleInShowHideMenu = false;
|
|
24
20
|
otherConfig.displayColumnDefOptions = getExpandColumnConfig(firstCol, tableConfig);
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
getSubRows:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
columns
|
|
32
|
-
data
|
|
22
|
+
const table = useMaterialReactTable({
|
|
23
|
+
getSubRows: row => row.children,
|
|
24
|
+
...muiStyleOverrides,
|
|
25
|
+
...otherConfig,
|
|
26
|
+
...tableConfig,
|
|
27
|
+
columns,
|
|
28
|
+
data,
|
|
33
29
|
initialState: merge({
|
|
34
30
|
density: "compact",
|
|
35
|
-
columnVisibility
|
|
31
|
+
columnVisibility
|
|
36
32
|
}, tableConfig.initialState || {})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
});
|
|
34
|
+
const customSetColumnVisibility = useCallback(columnVisibility => ({
|
|
35
|
+
...columnVisibility,
|
|
36
|
+
[firstCol.id]: false
|
|
37
|
+
}), [firstCol]);
|
|
41
38
|
if (tableConfig.enableExpanding) {
|
|
42
39
|
table.setColumnVisibility = customSetColumnVisibility;
|
|
43
40
|
}
|
|
44
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/_jsx(MaterialReactTable, {
|
|
45
42
|
table: table
|
|
46
43
|
});
|
|
47
44
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const muiStyleOverrides = {
|
|
2
2
|
muiBottomToolbarProps: {
|
|
3
3
|
sx: {
|
|
4
4
|
boxShadow: "none"
|
|
@@ -27,27 +27,29 @@ var muiStyleOverrides = {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
muiTableBodyRowProps:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
muiTableBodyRowProps: _ref => {
|
|
31
|
+
let {
|
|
32
|
+
row,
|
|
33
|
+
table
|
|
34
|
+
} = _ref;
|
|
35
|
+
let borderBottomStyle = "solid";
|
|
34
36
|
if (row.getIsExpanded()) {
|
|
35
37
|
borderBottomStyle = "dashed";
|
|
36
38
|
}
|
|
37
39
|
if (!row.originalSubRows && table.options.enableExpanding) {
|
|
38
40
|
var _row$getParentRow;
|
|
39
|
-
|
|
41
|
+
const subRows = (_row$getParentRow = row.getParentRow()) === null || _row$getParentRow === void 0 ? void 0 : _row$getParentRow.subRows;
|
|
40
42
|
if (!subRows) {
|
|
41
43
|
borderBottomStyle = "none";
|
|
42
44
|
} else {
|
|
43
|
-
|
|
45
|
+
const lastSubRowOfParent = subRows[subRows.length - 1];
|
|
44
46
|
borderBottomStyle = lastSubRowOfParent.id === row.id ? "solid" : "none";
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
return {
|
|
48
50
|
sx: {
|
|
49
51
|
"&:not(.Mui-TableBodyCell-DetailPanel) .MuiTableCell-root": {
|
|
50
|
-
borderBottomStyle
|
|
52
|
+
borderBottomStyle
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
};
|
|
@@ -2,58 +2,75 @@ import React from "react";
|
|
|
2
2
|
import Box from "../Box";
|
|
3
3
|
import { TabsContainer, Tab } from ".";
|
|
4
4
|
import Popover from "../Popover";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
6
|
export default {
|
|
6
7
|
title: "Components/Tabs/Tab",
|
|
7
|
-
decorators: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}],
|
|
8
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
9
|
+
bg: "greyLightest",
|
|
10
|
+
p: "xl",
|
|
11
|
+
children: storyFn()
|
|
12
|
+
})],
|
|
13
13
|
component: Tab
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
export const activeTab = () => /*#__PURE__*/_jsxs(TabsContainer, {
|
|
16
|
+
children: [/*#__PURE__*/_jsx(Tab, {
|
|
17
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
18
|
+
href: "#",
|
|
19
|
+
children: "Details"
|
|
20
|
+
})
|
|
21
|
+
}), /*#__PURE__*/_jsx(Tab, {
|
|
22
|
+
active: true,
|
|
23
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
24
|
+
href: "#",
|
|
25
|
+
children: "Planning"
|
|
26
|
+
})
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
24
29
|
activeTab.story = {
|
|
25
30
|
name: "Active Tab"
|
|
26
31
|
};
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
notification: "1"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, /*#__PURE__*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
export const withNotificationsTab = () => /*#__PURE__*/_jsxs(TabsContainer, {
|
|
33
|
+
children: [/*#__PURE__*/_jsx(Tab, {
|
|
34
|
+
notification: "1",
|
|
35
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
36
|
+
href: "#",
|
|
37
|
+
children: "Details"
|
|
38
|
+
})
|
|
39
|
+
}), /*#__PURE__*/_jsx(Tab, {
|
|
40
|
+
notification: "7",
|
|
41
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
42
|
+
href: "#",
|
|
43
|
+
children: "Planning"
|
|
44
|
+
})
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
38
47
|
activeTab.story = {
|
|
39
48
|
name: "With Notifications Tab"
|
|
40
49
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
50
|
+
export const withPopoverTab = () => /*#__PURE__*/_jsxs(TabsContainer, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Popover, {
|
|
43
52
|
direction: "right",
|
|
44
53
|
text: "Example with tooltip explaining tab",
|
|
45
|
-
width: "218px"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
width: "218px",
|
|
55
|
+
children: /*#__PURE__*/_jsx(Tab, {
|
|
56
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
57
|
+
href: "#",
|
|
58
|
+
children: "Details"
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
|
49
62
|
direction: "top",
|
|
50
63
|
text: "Example with tooltip explaining tab",
|
|
51
|
-
width: "218px"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
width: "218px",
|
|
65
|
+
children: /*#__PURE__*/_jsx(Tab, {
|
|
66
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
67
|
+
href: "#",
|
|
68
|
+
tabIndex: "-1",
|
|
69
|
+
children: "Additional information"
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
57
74
|
withPopoverTab.story = {
|
|
58
75
|
name: "With Popover Tab"
|
|
59
76
|
};
|