orc-shared 5.10.1-dev.7 → 5.10.1
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/dist/components/AppFrame/MenuItem.js +12 -3
- package/dist/components/CategoryList.js +197 -0
- package/dist/components/List/DataCell.js +129 -0
- package/dist/components/List/HeadCell.js +125 -0
- package/dist/components/List/HeadRow.js +73 -0
- package/dist/components/List/List.js +274 -0
- package/dist/components/List/Row.js +109 -0
- package/dist/components/List/enhanceColumnDefs.js +111 -0
- package/dist/components/List/index.js +59 -0
- package/dist/components/MaterialUI/DataDisplay/Table.js +1 -2
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +1 -3
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -3
- package/dist/components/ToastList.js +64 -95
- package/dist/getTheme.js +5 -0
- package/package.json +1 -1
- package/src/components/AppFrame/MenuItem.js +9 -1
- package/src/components/CategoryList.js +140 -0
- package/src/components/CategoryList.test.js +667 -0
- package/src/components/List/DataCell.js +77 -0
- package/src/components/List/DataCell.test.js +357 -0
- package/src/components/List/HeadCell.js +105 -0
- package/src/components/List/HeadCell.test.js +331 -0
- package/src/components/List/HeadRow.js +21 -0
- package/src/components/List/HeadRow.test.js +27 -0
- package/src/components/List/List.js +162 -0
- package/src/components/List/List.test.js +705 -0
- package/src/components/List/Row.js +72 -0
- package/src/components/List/Row.test.js +194 -0
- package/src/components/List/enhanceColumnDefs.js +54 -0
- package/src/components/List/enhanceColumnDefs.test.js +179 -0
- package/src/components/List/index.js +6 -0
- package/src/components/MaterialUI/DataDisplay/Table.js +1 -6
- package/src/components/MaterialUI/DataDisplay/Table.test.js +0 -20
- package/src/components/MaterialUI/DataDisplay/TableProps.js +0 -2
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +2 -20
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +1 -2
- package/src/components/ToastList.js +90 -79
- package/src/components/ToastList.test.js +103 -29
- package/src/getTheme.js +5 -0
- package/dist/utils/toastHelper.js +0 -52
- package/src/utils/toastHelper.js +0 -8
- package/src/utils/toastHelper.test.js +0 -41
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.default = exports.ToastList = exports.Toast = void 0;
|
|
4
|
+
exports.default = exports.ToastList = exports.ToastIcon = exports.ToastBox = exports.Toast = exports.CloseIcon = void 0;
|
|
5
5
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var _styles = require("@material-ui/core/styles");
|
|
9
|
-
var _Icon = _interopRequireDefault(require("./MaterialUI/DataDisplay/Icon"));
|
|
10
|
-
var _toastHelper = require("../utils/toastHelper");
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var _styledTransitionGroup = _interopRequireDefault(require("styled-transition-group"));
|
|
11
8
|
var _reactTransitionGroup = require("react-transition-group");
|
|
9
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
|
+
var _polished = require("polished");
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
var _Text = _interopRequireDefault(require("./Text"));
|
|
13
|
+
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
12
14
|
var _excluded = ["message", "type", "closeFunc"];
|
|
15
|
+
var _templateObject;
|
|
13
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
17
|
(function () {
|
|
15
18
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
@@ -22,6 +25,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
22
25
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
23
26
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
27
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
28
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
25
29
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
26
30
|
return a;
|
|
27
31
|
};
|
|
@@ -34,65 +38,36 @@ if (!portal.parent) {
|
|
|
34
38
|
portal.id = "toast";
|
|
35
39
|
document.body.appendChild(portal);
|
|
36
40
|
}
|
|
37
|
-
var
|
|
41
|
+
var toastTransitionTime = 300;
|
|
42
|
+
var ToastBox = exports.ToastBox = _styledTransitionGroup.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tdisplay: flex;\n\twidth: 390px;\n\tmargin-top: 10px;\n\tpadding: 17px;\n\tborder-radius: 5px;\n\tfont-size: 14px;\n\tcolor: white;\n\tbackground-color: ", ";\n\tz-index: 10000;\n\n\t& > * {\n\t\tmargin-top: auto;\n\t\tmargin-bottom: auto;\n\t}\n\t\n\t&:enter {\n\t\ttransform: translateX(200%);\n\t}\n\t&:enter-active {\n\t\ttransform: translateX(0);\n\t\ttransition: transform ", "ms ease-out;\n\t}\n\t&:exit {\n\t\ttransform-origin: top;\n\t\ttransform: scale(1,1);\n\t}\n\t&:exit ~ & {\n\t\ttransform: translateY(0);\n\t}\n\t&:exit-active {\n\t\ttransform: scale(1, 0.001);\n\t\ttransition: transform ", "ms ease-out;\n\t}\n\t&:exit-active ~ & {\n\t\ttransition: transform ", "ms ease-out;\n\t\ttransform: translateY(-100%);\n\t}\n"])), (0, _utils.getThemeProp)(["colors", "toasts", function (props) {
|
|
43
|
+
return props.type;
|
|
44
|
+
}], "#999"), toastTransitionTime, toastTransitionTime, toastTransitionTime);
|
|
45
|
+
ToastBox.defaultProps = {
|
|
46
|
+
timeout: toastTransitionTime,
|
|
47
|
+
unmountOnExit: true
|
|
48
|
+
};
|
|
49
|
+
var ToastIcon = exports.ToastIcon = (0, _styledComponents.default)(_Icon.default).attrs(function (props) {
|
|
50
|
+
return {
|
|
51
|
+
id: (0, _utils.getThemeProp)(["icons", "toast", function (props) {
|
|
52
|
+
return props.type;
|
|
53
|
+
}], "bubble-chat-2")(props)
|
|
54
|
+
};
|
|
55
|
+
}).withConfig({
|
|
56
|
+
displayName: "ToastList__ToastIcon",
|
|
57
|
+
componentId: "sc-ux3rdy-0"
|
|
58
|
+
})(["font-size:20px;margin-right:16px;stroke-width:2px;"]);
|
|
59
|
+
var CloseIcon = exports.CloseIcon = (0, _styledComponents.default)(_Icon.default).attrs(function (props) {
|
|
38
60
|
return {
|
|
39
|
-
|
|
40
|
-
var toastColor = (0, _toastHelper.getToastColor)(theme, props.toastType);
|
|
41
|
-
return {
|
|
42
|
-
display: "flex",
|
|
43
|
-
width: "390px",
|
|
44
|
-
marginTop: "10px",
|
|
45
|
-
padding: "17px",
|
|
46
|
-
borderRadius: "5px",
|
|
47
|
-
fontSize: "14px",
|
|
48
|
-
color: "white",
|
|
49
|
-
backgroundColor: toastColor,
|
|
50
|
-
zIndex: 10000,
|
|
51
|
-
"& > *": {
|
|
52
|
-
marginTop: "auto",
|
|
53
|
-
marginBottom: "auto"
|
|
54
|
-
},
|
|
55
|
-
"&.enter": {
|
|
56
|
-
transform: "translateX(200%)"
|
|
57
|
-
},
|
|
58
|
-
"&.enter-active": {
|
|
59
|
-
transform: "translateX(0)",
|
|
60
|
-
transition: "transform 300ms ease-out"
|
|
61
|
-
},
|
|
62
|
-
"&.exit": {
|
|
63
|
-
transformOrigin: "top",
|
|
64
|
-
transform: "scale(1,1)"
|
|
65
|
-
},
|
|
66
|
-
"&.exit ~ &": {
|
|
67
|
-
transform: "translateY(0)"
|
|
68
|
-
},
|
|
69
|
-
"&.exit-active": {
|
|
70
|
-
transform: "scale(1, 0.001)",
|
|
71
|
-
transition: "transform 300ms ease-out"
|
|
72
|
-
},
|
|
73
|
-
"&.exit-active ~ &": {
|
|
74
|
-
transition: "transform 300ms ease-out",
|
|
75
|
-
transform: "translateY(-100%)"
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
listWrapper: {
|
|
80
|
-
position: "absolute",
|
|
81
|
-
top: "40px",
|
|
82
|
-
right: "16px",
|
|
83
|
-
display: "flex",
|
|
84
|
-
flexDirection: "column"
|
|
85
|
-
},
|
|
86
|
-
closeIcon: {
|
|
87
|
-
padding: "2px",
|
|
88
|
-
borderRadius: "2px",
|
|
89
|
-
strokeWidth: "2px",
|
|
90
|
-
cursor: "pointer",
|
|
91
|
-
marginLeft: "auto",
|
|
92
|
-
fontSize: "20px"
|
|
93
|
-
}
|
|
61
|
+
id: (0, _utils.getThemeProp)(["icons", "close"], "close")(props)
|
|
94
62
|
};
|
|
95
|
-
})
|
|
63
|
+
}).withConfig({
|
|
64
|
+
displayName: "ToastList__CloseIcon",
|
|
65
|
+
componentId: "sc-ux3rdy-1"
|
|
66
|
+
})(["position:absolute;top:8px;right:8px;font-size:10px;padding:2px;border-radius:2px;stroke-width:2px;&:hover{background-color:", ";}"], (0, _utils.getThemeProp)(["colors", "toasts", function (props) {
|
|
67
|
+
return props.type;
|
|
68
|
+
}], "#999999", function (color) {
|
|
69
|
+
return (0, _polished.shade)(0.3, color);
|
|
70
|
+
}));
|
|
96
71
|
var Toast = exports.Toast = function Toast(_ref) {
|
|
97
72
|
var _ref$message = _ref.message,
|
|
98
73
|
message = _ref$message === void 0 ? "[No message]" : _ref$message,
|
|
@@ -100,44 +75,30 @@ var Toast = exports.Toast = function Toast(_ref) {
|
|
|
100
75
|
type = _ref$type === void 0 ? "" : _ref$type,
|
|
101
76
|
closeFunc = _ref.closeFunc,
|
|
102
77
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
className: classes.closeIcon,
|
|
115
|
-
onClick: closeFunc
|
|
116
|
-
}) : null));
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(ToastBox, {
|
|
79
|
+
type: type,
|
|
80
|
+
in: props.in
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(ToastIcon, {
|
|
82
|
+
type: type
|
|
83
|
+
}), /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
84
|
+
message: message
|
|
85
|
+
}), closeFunc ? /*#__PURE__*/_react.default.createElement(CloseIcon, {
|
|
86
|
+
onClick: closeFunc,
|
|
87
|
+
type: type
|
|
88
|
+
}) : null);
|
|
117
89
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return [useStyles];
|
|
123
|
-
});
|
|
90
|
+
var ListWrapper = (0, _styledComponents.default)(_reactTransitionGroup.TransitionGroup).withConfig({
|
|
91
|
+
displayName: "ToastList__ListWrapper",
|
|
92
|
+
componentId: "sc-ux3rdy-2"
|
|
93
|
+
})(["position:absolute;top:40px;right:16px;display:flex;flex-direction:column;"]);
|
|
124
94
|
var ToastList = exports.ToastList = function ToastList(_ref2) {
|
|
125
95
|
var toasts = _ref2.toasts;
|
|
126
|
-
|
|
127
|
-
return _reactDom.default.createPortal(/*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, {
|
|
128
|
-
className: classes.listWrapper
|
|
129
|
-
}, toasts.map(function (props, idx) {
|
|
96
|
+
return _reactDom.default.createPortal(/*#__PURE__*/_react.default.createElement(ListWrapper, null, toasts.map(function (props, idx) {
|
|
130
97
|
return /*#__PURE__*/_react.default.createElement(Toast, _extends({
|
|
131
98
|
key: "toast" + idx
|
|
132
99
|
}, props));
|
|
133
100
|
})), portal);
|
|
134
101
|
};
|
|
135
|
-
__signature__(ToastList, "useStyles{classes}", function () {
|
|
136
|
-
return [useStyles];
|
|
137
|
-
});
|
|
138
|
-
__signature__(ToastList, "useStyles{classes}", function () {
|
|
139
|
-
return [useStyles];
|
|
140
|
-
});
|
|
141
102
|
var _default = ToastList;
|
|
142
103
|
var _default2 = _default;
|
|
143
104
|
var _default3 = exports.default = _default2;
|
|
@@ -148,8 +109,12 @@ var _default3 = exports.default = _default2;
|
|
|
148
109
|
return;
|
|
149
110
|
}
|
|
150
111
|
reactHotLoader.register(portal, "portal", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
151
|
-
reactHotLoader.register(
|
|
112
|
+
reactHotLoader.register(toastTransitionTime, "toastTransitionTime", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
113
|
+
reactHotLoader.register(ToastBox, "ToastBox", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
114
|
+
reactHotLoader.register(ToastIcon, "ToastIcon", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
115
|
+
reactHotLoader.register(CloseIcon, "CloseIcon", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
152
116
|
reactHotLoader.register(Toast, "Toast", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
117
|
+
reactHotLoader.register(ListWrapper, "ListWrapper", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
153
118
|
reactHotLoader.register(ToastList, "ToastList", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
154
119
|
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
155
120
|
})();
|
|
@@ -165,8 +130,12 @@ var _default3 = exports.default = _default2;
|
|
|
165
130
|
return;
|
|
166
131
|
}
|
|
167
132
|
reactHotLoader.register(portal, "portal", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
168
|
-
reactHotLoader.register(
|
|
133
|
+
reactHotLoader.register(toastTransitionTime, "toastTransitionTime", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
134
|
+
reactHotLoader.register(ToastBox, "ToastBox", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
135
|
+
reactHotLoader.register(ToastIcon, "ToastIcon", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
136
|
+
reactHotLoader.register(CloseIcon, "CloseIcon", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
169
137
|
reactHotLoader.register(Toast, "Toast", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
138
|
+
reactHotLoader.register(ListWrapper, "ListWrapper", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
170
139
|
reactHotLoader.register(ToastList, "ToastList", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
171
140
|
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/ToastList.js");
|
|
172
141
|
})();
|
package/dist/getTheme.js
CHANGED
|
@@ -72,6 +72,11 @@ var baseTheme = {
|
|
|
72
72
|
Sale: "sales-scope",
|
|
73
73
|
Dependant: "dependent-scope"
|
|
74
74
|
},
|
|
75
|
+
// toast: {
|
|
76
|
+
// confirm: "checkmark-circle",
|
|
77
|
+
// warn: "warning",
|
|
78
|
+
// error: "cross-circle",
|
|
79
|
+
// },
|
|
75
80
|
prev: "arrow-small-left",
|
|
76
81
|
next: "arrow-small-right",
|
|
77
82
|
menu: "app-list",
|
package/package.json
CHANGED
|
@@ -3,7 +3,15 @@ import { makeStyles } from "@material-ui/core/styles";
|
|
|
3
3
|
import { Link } from "react-router-dom";
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import Icon from "../MaterialUI/DataDisplay/Icon";
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
const getToastColor = (theme, alertType) => {
|
|
8
|
+
const toastBorderColors = {
|
|
9
|
+
error: theme.palette.error.main,
|
|
10
|
+
warn: theme.palette.warning.main,
|
|
11
|
+
confirm: theme.palette.success.main,
|
|
12
|
+
};
|
|
13
|
+
return toastBorderColors[alertType] || "red";
|
|
14
|
+
};
|
|
7
15
|
|
|
8
16
|
const useStyles = makeStyles(theme => ({
|
|
9
17
|
block: props => ({
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Multiple lists with a single header, aligned with each other
|
|
3
|
+
No virtualization or page loading
|
|
4
|
+
Categories can be folded up to hide content
|
|
5
|
+
Sortable, within categories
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
import styled, { css } from "styled-components";
|
|
9
|
+
import { compose, setDisplayName } from "recompose";
|
|
10
|
+
import { safeGet, ifFlag, getThemeProp } from "../utils";
|
|
11
|
+
import withScrollBox from "../hocs/withScrollBox";
|
|
12
|
+
import useViewState from "../hooks/useViewState";
|
|
13
|
+
import Icon from "./Icon";
|
|
14
|
+
import Row from "./List/Row";
|
|
15
|
+
import HeadRow from "./List/HeadRow";
|
|
16
|
+
import { useListState, Table, Placeholder, HEADER_HEIGHT } from "./List/List";
|
|
17
|
+
|
|
18
|
+
const arrayToggle = (array, item) => (array.includes(item) ? array.filter(x => x !== item) : array.concat(item));
|
|
19
|
+
|
|
20
|
+
export const CategoryRow = styled.tr``;
|
|
21
|
+
|
|
22
|
+
export const CategoryHeader = styled.td`
|
|
23
|
+
border: 0 solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
24
|
+
border-top-width: 1px;
|
|
25
|
+
tr:first-child & {
|
|
26
|
+
border-top-width: 0;
|
|
27
|
+
}
|
|
28
|
+
tr:last-child & {
|
|
29
|
+
border-bottom-width: 1px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
position: relative;
|
|
33
|
+
padding: 11px 45px;
|
|
34
|
+
background-color: #f1eae0;
|
|
35
|
+
${ifFlag(
|
|
36
|
+
"closed",
|
|
37
|
+
css`
|
|
38
|
+
border-bottom: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
39
|
+
`,
|
|
40
|
+
)}
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
export const CategoryIndicator = styled(Icon).attrs(props => ({
|
|
45
|
+
id: ifFlag(
|
|
46
|
+
"closed",
|
|
47
|
+
getThemeProp(["icons", "indicators", "right"], "chevron-right"),
|
|
48
|
+
getThemeProp(["icons", "indicators", "down"], "chevron-down"),
|
|
49
|
+
)(props),
|
|
50
|
+
}))`
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: 22px;
|
|
54
|
+
top: 15px;
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
export const CategoryList = ({
|
|
58
|
+
name,
|
|
59
|
+
columnDefs = [],
|
|
60
|
+
rows = [],
|
|
61
|
+
rowOnClick,
|
|
62
|
+
placeholder,
|
|
63
|
+
keyField = ["id"],
|
|
64
|
+
categoryField = ["category"],
|
|
65
|
+
openAll = false,
|
|
66
|
+
height,
|
|
67
|
+
rowBackgroundGetter = () => {},
|
|
68
|
+
}) => {
|
|
69
|
+
const [enhancedColumnDefs, selection] = useListState(name, columnDefs);
|
|
70
|
+
const [{ closedCategories = [] }, updateViewState] = useViewState(name);
|
|
71
|
+
if (columnDefs.length === 0) return null;
|
|
72
|
+
const rowIds = [],
|
|
73
|
+
rowCategories = {};
|
|
74
|
+
rows.forEach((row, index) => {
|
|
75
|
+
const id = safeGet(row, ...keyField) + ""; // Ensure rowId is string
|
|
76
|
+
const category = safeGet(row, ...categoryField) || "";
|
|
77
|
+
rowIds.push(id);
|
|
78
|
+
if (!rowCategories[category]) {
|
|
79
|
+
rowCategories[category] = [];
|
|
80
|
+
}
|
|
81
|
+
rowCategories[category].push(
|
|
82
|
+
<Row
|
|
83
|
+
columnDefs={enhancedColumnDefs}
|
|
84
|
+
key={id}
|
|
85
|
+
rowId={id}
|
|
86
|
+
row={row}
|
|
87
|
+
rowOnClick={rowOnClick}
|
|
88
|
+
selected={selection.indexOf(id) !== -1}
|
|
89
|
+
bgColor={rowBackgroundGetter(row, index)}
|
|
90
|
+
/>,
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
const rowElements = [];
|
|
94
|
+
if (Object.keys(rowCategories).length === 0) {
|
|
95
|
+
if (placeholder) {
|
|
96
|
+
rowElements.push(
|
|
97
|
+
<Placeholder key="placeholder" width={columnDefs.length} height={height - HEADER_HEIGHT}>
|
|
98
|
+
{placeholder}
|
|
99
|
+
</Placeholder>,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
Object.entries(rowCategories).forEach(([key, rows]) => {
|
|
104
|
+
const clickHandler = () => updateViewState("closedCategories", arrayToggle(closedCategories, key));
|
|
105
|
+
const closed = !openAll && closedCategories.includes(key);
|
|
106
|
+
rowElements.push(
|
|
107
|
+
<CategoryRow key={"category_" + key}>
|
|
108
|
+
<CategoryHeader
|
|
109
|
+
data-test-id={"category_" + key}
|
|
110
|
+
closed={closed}
|
|
111
|
+
colSpan={columnDefs.length}
|
|
112
|
+
onClick={clickHandler}
|
|
113
|
+
>
|
|
114
|
+
<CategoryIndicator closed={closed} />
|
|
115
|
+
{key}
|
|
116
|
+
</CategoryHeader>
|
|
117
|
+
</CategoryRow>,
|
|
118
|
+
);
|
|
119
|
+
if (!closed) {
|
|
120
|
+
rowElements.push(...rows);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return (
|
|
125
|
+
<Table>
|
|
126
|
+
<thead>
|
|
127
|
+
<HeadRow
|
|
128
|
+
columnDefs={enhancedColumnDefs}
|
|
129
|
+
rowIds={rowIds}
|
|
130
|
+
allSelected={rows.length === selection.length && rows.length !== 0}
|
|
131
|
+
/>
|
|
132
|
+
</thead>
|
|
133
|
+
<tbody>{rowElements}</tbody>
|
|
134
|
+
</Table>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const StatefulCategoryList = compose(setDisplayName("CategoryList"), withScrollBox)(CategoryList);
|
|
139
|
+
|
|
140
|
+
export default StatefulCategoryList;
|