@dhis2-ui/table 8.2.0 → 8.2.3
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/build/cjs/data-table/__tests__/data-table-row/expanded-row.test.js +2 -2
- package/build/cjs/data-table/data-table-cell.js +23 -22
- package/build/cjs/data-table/data-table-column-header/data-table-column-header.js +60 -57
- package/build/cjs/data-table/data-table-column-header/data-table-column-header.styles.js +1 -1
- package/build/cjs/data-table/data-table-column-header/filter-handle.js +6 -5
- package/build/cjs/data-table/data-table-column-header/sorter.js +9 -8
- package/build/cjs/data-table/data-table-row/data-table-row.js +12 -11
- package/build/cjs/data-table/data-table-row/data-table-row.styles.js +1 -1
- package/build/cjs/data-table/data-table-row/expand-handle-cell.js +15 -12
- package/build/cjs/data-table/data-table-row/expanded-row.js +23 -20
- package/build/cjs/data-table/data-table.js +12 -11
- package/build/cjs/data-table/data-table.stories.e2e.js +1 -1
- package/build/cjs/data-table/data-table.stories.js +147 -145
- package/build/cjs/data-table/table-elements/__tests__/table-data-cell.test.js +3 -3
- package/build/cjs/data-table/table-elements/__tests__/table-header-cell.test.js +4 -4
- package/build/cjs/data-table/table-elements/__tests__/table.test.js +2 -2
- package/build/cjs/data-table/table-elements/index.js +8 -8
- package/build/cjs/data-table/table-elements/table-body.js +21 -18
- package/build/cjs/data-table/table-elements/table-data-cell/table-data-cell.js +40 -37
- package/build/cjs/data-table/table-elements/table-data-cell/table-data-cell.styles.js +1 -1
- package/build/cjs/data-table/table-elements/table-foot.js +15 -12
- package/build/cjs/data-table/table-elements/table-head.js +15 -12
- package/build/cjs/data-table/table-elements/table-header-cell/table-header-cell.js +43 -40
- package/build/cjs/data-table/table-elements/table-header-cell/table-header-cell.styles.js +1 -1
- package/build/cjs/data-table/table-elements/table-header-cell-action.js +20 -17
- package/build/cjs/data-table/table-elements/table-row.js +21 -18
- package/build/cjs/data-table/table-elements/table-scroll-box.js +18 -15
- package/build/cjs/data-table/table-elements/table-toolbar.js +17 -14
- package/build/cjs/data-table/table-elements/table.js +23 -20
- package/build/cjs/data-table/table-elements/table.stories.e2e.js +1 -1
- package/build/cjs/data-table/table-elements/table.stories.internal.js +119 -127
- package/build/cjs/index.js +42 -42
- package/build/cjs/stacked-table/content-with-title.js +14 -11
- package/build/cjs/stacked-table/index.js +10 -10
- package/build/cjs/stacked-table/stacked-table-body.js +13 -10
- package/build/cjs/stacked-table/stacked-table-cell-head.js +20 -17
- package/build/cjs/stacked-table/stacked-table-cell.js +13 -12
- package/build/cjs/stacked-table/stacked-table-foot.js +13 -10
- package/build/cjs/stacked-table/stacked-table-head.js +13 -10
- package/build/cjs/stacked-table/stacked-table-row-head.js +11 -8
- package/build/cjs/stacked-table/stacked-table-row.js +19 -13
- package/build/cjs/stacked-table/stacked-table.js +7 -6
- package/build/cjs/stacked-table/stacked-table.stories.js +3 -20
- package/build/cjs/stacked-table/stacked-table.test.js +24 -15
- package/build/cjs/stacked-table/table-context.js +1 -1
- package/build/cjs/stacked-table/table.js +14 -11
- package/build/cjs/table/index.js +10 -10
- package/build/cjs/table/table-body.js +13 -10
- package/build/cjs/table/table-cell-head.js +22 -19
- package/build/cjs/table/table-cell.js +22 -19
- package/build/cjs/table/table-context.js +1 -1
- package/build/cjs/table/table-foot.js +13 -10
- package/build/cjs/table/table-head.js +13 -10
- package/build/cjs/table/table-row-head.js +15 -12
- package/build/cjs/table/table-row.js +9 -8
- package/build/cjs/table/table.js +19 -16
- package/build/cjs/table/table.stories.js +3 -18
- package/build/es/data-table/__tests__/data-table-row/expanded-row.test.js +2 -2
- package/build/es/data-table/data-table-cell.js +23 -22
- package/build/es/data-table/data-table-column-header/data-table-column-header.js +60 -57
- package/build/es/data-table/data-table-column-header/filter-handle.js +6 -5
- package/build/es/data-table/data-table-column-header/sorter.js +8 -7
- package/build/es/data-table/data-table-row/data-table-row.js +12 -11
- package/build/es/data-table/data-table-row/data-table-row.styles.js +1 -1
- package/build/es/data-table/data-table-row/expand-handle-cell.js +15 -12
- package/build/es/data-table/data-table-row/expanded-row.js +23 -20
- package/build/es/data-table/data-table.js +12 -11
- package/build/es/data-table/data-table.stories.js +146 -144
- package/build/es/data-table/table-elements/__tests__/table-data-cell.test.js +3 -3
- package/build/es/data-table/table-elements/__tests__/table-header-cell.test.js +4 -4
- package/build/es/data-table/table-elements/__tests__/table.test.js +2 -2
- package/build/es/data-table/table-elements/table-body.js +21 -18
- package/build/es/data-table/table-elements/table-data-cell/table-data-cell.js +40 -37
- package/build/es/data-table/table-elements/table-data-cell/table-data-cell.styles.js +1 -1
- package/build/es/data-table/table-elements/table-foot.js +15 -12
- package/build/es/data-table/table-elements/table-head.js +15 -12
- package/build/es/data-table/table-elements/table-header-cell/table-header-cell.js +43 -40
- package/build/es/data-table/table-elements/table-header-cell/table-header-cell.styles.js +1 -1
- package/build/es/data-table/table-elements/table-header-cell-action.js +20 -17
- package/build/es/data-table/table-elements/table-row.js +21 -18
- package/build/es/data-table/table-elements/table-scroll-box.js +18 -15
- package/build/es/data-table/table-elements/table-toolbar.js +17 -14
- package/build/es/data-table/table-elements/table.js +23 -20
- package/build/es/data-table/table-elements/table.stories.internal.js +118 -126
- package/build/es/stacked-table/content-with-title.js +14 -11
- package/build/es/stacked-table/stacked-table-body.js +13 -10
- package/build/es/stacked-table/stacked-table-cell-head.js +20 -17
- package/build/es/stacked-table/stacked-table-cell.js +13 -12
- package/build/es/stacked-table/stacked-table-foot.js +13 -10
- package/build/es/stacked-table/stacked-table-head.js +13 -10
- package/build/es/stacked-table/stacked-table-row-head.js +11 -8
- package/build/es/stacked-table/stacked-table-row.js +19 -13
- package/build/es/stacked-table/stacked-table.js +7 -6
- package/build/es/stacked-table/stacked-table.stories.js +2 -19
- package/build/es/stacked-table/stacked-table.test.js +24 -15
- package/build/es/stacked-table/table.js +14 -11
- package/build/es/table/table-body.js +13 -10
- package/build/es/table/table-cell-head.js +22 -19
- package/build/es/table/table-cell.js +22 -19
- package/build/es/table/table-foot.js +13 -10
- package/build/es/table/table-head.js +13 -10
- package/build/es/table/table-row-head.js +15 -12
- package/build/es/table/table-row.js +9 -8
- package/build/es/table/table.js +19 -16
- package/build/es/table/table.stories.js +2 -17
- package/package.json +3 -3
|
@@ -13,18 +13,21 @@ var _tableRow = require("./table-row.js");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const TableRowHead =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const TableRowHead = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
role,
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
dataTest,
|
|
22
|
+
suppressZebraStriping
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_tableRow.TableRow, {
|
|
25
|
+
className: className,
|
|
26
|
+
dataTest: dataTest,
|
|
27
|
+
suppressZebraStriping: suppressZebraStriping,
|
|
28
|
+
role: role
|
|
29
|
+
}, children);
|
|
30
|
+
};
|
|
28
31
|
|
|
29
32
|
exports.TableRowHead = TableRowHead;
|
|
30
33
|
TableRowHead.defaultProps = {
|
|
@@ -24,13 +24,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
24
24
|
const tableRowStyles = [".zebraStriping.jsx-3124144591:nth-child(even){background:#fbfcfd;}"];
|
|
25
25
|
tableRowStyles.__hash = "3124144591";
|
|
26
26
|
|
|
27
|
-
const TableRow =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const TableRow = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
role,
|
|
30
|
+
children,
|
|
31
|
+
className,
|
|
32
|
+
dataTest,
|
|
33
|
+
suppressZebraStriping
|
|
34
|
+
} = _ref;
|
|
34
35
|
const {
|
|
35
36
|
suppressZebraStriping: suppressZebraStripingFromContext
|
|
36
37
|
} = (0, _react.useContext)(_tableContext.TableContext);
|
|
@@ -38,7 +39,7 @@ const TableRow = ({
|
|
|
38
39
|
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
39
40
|
"data-test": dataTest,
|
|
40
41
|
role: role,
|
|
41
|
-
className:
|
|
42
|
+
className: "jsx-".concat(tableRowStyles.__hash) + " " + ((0, _classnames.default)(className, {
|
|
42
43
|
zebraStriping
|
|
43
44
|
}) || "")
|
|
44
45
|
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
package/build/cjs/table/table.js
CHANGED
|
@@ -18,23 +18,26 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
const tableStyles = ["table.jsx-2430604489{border:1px solid #e8edf2;background-color:#ffffff;min-width:100%;text-align:left;border-collapse:collapse;vertical-align:top;}"];
|
|
19
19
|
tableStyles.__hash = "2430604489";
|
|
20
20
|
|
|
21
|
-
const Table =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) => /*#__PURE__*/_react.default.createElement(_tableContext.Provider, {
|
|
28
|
-
value: {
|
|
21
|
+
const Table = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
role,
|
|
24
|
+
children,
|
|
25
|
+
className,
|
|
26
|
+
dataTest,
|
|
29
27
|
suppressZebraStriping
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
} = _ref;
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_tableContext.Provider, {
|
|
30
|
+
value: {
|
|
31
|
+
suppressZebraStriping
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
34
|
+
"data-test": dataTest,
|
|
35
|
+
role: role,
|
|
36
|
+
className: "jsx-".concat(tableStyles.__hash) + " " + (className || "")
|
|
37
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
38
|
+
id: tableStyles.__hash
|
|
39
|
+
}, tableStyles)));
|
|
40
|
+
};
|
|
38
41
|
|
|
39
42
|
exports.Table = Table;
|
|
40
43
|
Table.defaultProps = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.StaticLayout = exports.OneDenseCell = exports.NoAlternatingBgColor = exports.CustomAlternatingBgColor = void 0;
|
|
7
7
|
|
|
8
8
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
9
|
|
|
@@ -30,22 +30,7 @@ var _table = require("./table.js");
|
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
|
|
32
32
|
const subtitle = 'Used to display information in a standard, effective way.';
|
|
33
|
-
const description =
|
|
34
|
-
Should be used with multiple Table-related child components - see the table and examples below.
|
|
35
|
-
|
|
36
|
-
\`\`\`js
|
|
37
|
-
import {
|
|
38
|
-
Table,
|
|
39
|
-
TableBody,
|
|
40
|
-
TableCell,
|
|
41
|
-
TableCellHead,
|
|
42
|
-
TableFoot,
|
|
43
|
-
TableHead,
|
|
44
|
-
TableRow,
|
|
45
|
-
TableRowHead,
|
|
46
|
-
} from '@dhis2/ui'
|
|
47
|
-
\`\`\`
|
|
48
|
-
`;
|
|
33
|
+
const description = "\nShould be used with multiple Table-related child components - see the table and examples below.\n\n```js\nimport {\n Table,\n TableBody,\n TableCell,\n TableCellHead,\n TableFoot,\n TableHead,\n TableRow,\n TableRowHead,\n} from '@dhis2/ui'\n```\n";
|
|
49
34
|
|
|
50
35
|
const TableFooterButton = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
51
36
|
className: "jsx-3056176987"
|
|
@@ -60,7 +45,7 @@ const TableButton = () => /*#__PURE__*/_react.default.createElement(_button.Butt
|
|
|
60
45
|
}, "Table button");
|
|
61
46
|
|
|
62
47
|
var _default = {
|
|
63
|
-
title: '
|
|
48
|
+
title: 'Table',
|
|
64
49
|
component: _table.Table,
|
|
65
50
|
// Add subcomponents to the args table
|
|
66
51
|
subcomponents: {
|
|
@@ -20,14 +20,14 @@ describe('<ExpandedRow>', () => {
|
|
|
20
20
|
const wrapper = shallow( /*#__PURE__*/React.createElement(ExpandedRow, {
|
|
21
21
|
className: className
|
|
22
22
|
}));
|
|
23
|
-
expect(wrapper.find(TableRow).prop('className')).toBe(
|
|
23
|
+
expect(wrapper.find(TableRow).prop('className')).toBe("".concat(className, "-expandedrow"));
|
|
24
24
|
});
|
|
25
25
|
it('accepts a dataTest prop', () => {
|
|
26
26
|
const dataTest = 'test';
|
|
27
27
|
const wrapper = shallow( /*#__PURE__*/React.createElement(ExpandedRow, {
|
|
28
28
|
dataTest: dataTest
|
|
29
29
|
}));
|
|
30
|
-
expect(wrapper.find(TableRow).prop('dataTest')).toBe(
|
|
30
|
+
expect(wrapper.find(TableRow).prop('dataTest')).toBe("".concat(dataTest, "-expandedrow"));
|
|
31
31
|
});
|
|
32
32
|
it('accepts a selected prop', () => {
|
|
33
33
|
const wrapper = shallow( /*#__PURE__*/React.createElement(ExpandedRow, {
|
|
@@ -2,28 +2,29 @@ import { mutuallyExclusive, requiredIf } from '@dhis2/prop-types';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { TableDataCell, TableHeaderCell } from './table-elements/index.js';
|
|
5
|
-
export const DataTableCell = /*#__PURE__*/forwardRef(({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
export const DataTableCell = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
|
+
let {
|
|
7
|
+
active,
|
|
8
|
+
align,
|
|
9
|
+
bordered,
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
colSpan,
|
|
13
|
+
dataTest,
|
|
14
|
+
error,
|
|
15
|
+
fixed,
|
|
16
|
+
large,
|
|
17
|
+
left,
|
|
18
|
+
muted,
|
|
19
|
+
rowSpan,
|
|
20
|
+
role,
|
|
21
|
+
scope,
|
|
22
|
+
staticStyle,
|
|
23
|
+
tag,
|
|
24
|
+
valid,
|
|
25
|
+
width,
|
|
26
|
+
onClick
|
|
27
|
+
} = _ref;
|
|
27
28
|
const TableCell = !tag && fixed || tag && tag === 'th' ? TableHeaderCell : TableDataCell;
|
|
28
29
|
return /*#__PURE__*/React.createElement(TableCell, {
|
|
29
30
|
active: active,
|
|
@@ -12,63 +12,66 @@ const flexboxAlignLookup = {
|
|
|
12
12
|
center: 'center',
|
|
13
13
|
right: 'flex-end'
|
|
14
14
|
};
|
|
15
|
-
export const DataTableColumnHeader = /*#__PURE__*/forwardRef(({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
sortDirection
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
},
|
|
15
|
+
export const DataTableColumnHeader = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
+
let {
|
|
17
|
+
align,
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
colSpan,
|
|
21
|
+
dataTest,
|
|
22
|
+
filter,
|
|
23
|
+
fixed,
|
|
24
|
+
large,
|
|
25
|
+
left,
|
|
26
|
+
name,
|
|
27
|
+
role,
|
|
28
|
+
rowSpan,
|
|
29
|
+
scope,
|
|
30
|
+
showFilter,
|
|
31
|
+
sortDirection,
|
|
32
|
+
sortIconTitle,
|
|
33
|
+
top,
|
|
34
|
+
width,
|
|
35
|
+
onFilterIconClick,
|
|
36
|
+
onSortIconClick
|
|
37
|
+
} = _ref;
|
|
38
|
+
return /*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
39
|
+
align: align,
|
|
40
|
+
className: cx(className, 'DataTableColumnHeader', resolvedTableHeaderCss.className),
|
|
41
|
+
colSpan: colSpan,
|
|
42
|
+
dataTest: dataTest,
|
|
43
|
+
fixed: fixed,
|
|
44
|
+
large: large,
|
|
45
|
+
left: left,
|
|
46
|
+
ref: ref,
|
|
47
|
+
rowSpan: rowSpan,
|
|
48
|
+
role: role,
|
|
49
|
+
scope: scope,
|
|
50
|
+
top: top,
|
|
51
|
+
width: width
|
|
52
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
className: "jsx-3463223249 " + "jsx-".concat(styles.__hash) + " " + "container"
|
|
54
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
55
|
+
className: "jsx-3463223249 " + "jsx-".concat(styles.__hash) + " " + (cx('top', {
|
|
56
|
+
large
|
|
57
|
+
}) || "")
|
|
58
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: "jsx-3463223249 " + "jsx-".concat(styles.__hash) + " " + "content"
|
|
60
|
+
}, children), sortDirection && /*#__PURE__*/React.createElement(Sorter, {
|
|
61
|
+
name: name,
|
|
62
|
+
sortDirection: sortDirection,
|
|
63
|
+
onClick: onSortIconClick,
|
|
64
|
+
title: sortIconTitle
|
|
65
|
+
}), filter && /*#__PURE__*/React.createElement(FilterHandle, {
|
|
66
|
+
name: name,
|
|
67
|
+
active: showFilter,
|
|
68
|
+
onClick: onFilterIconClick
|
|
69
|
+
})), showFilter && filter), resolvedTableHeaderCss.styles, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
70
|
+
id: styles.__hash
|
|
71
|
+
}, styles), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
72
|
+
id: "3463223249"
|
|
73
|
+
}, [".label.jsx-3463223249{-webkit-box-pack:".concat(flexboxAlignLookup[align], ";-webkit-justify-content:").concat(flexboxAlignLookup[align], ";-ms-flex-pack:").concat(flexboxAlignLookup[align], ";justify-content:").concat(flexboxAlignLookup[align], ";}")]));
|
|
74
|
+
});
|
|
72
75
|
DataTableColumnHeader.displayName = 'DataTableColumnHeader';
|
|
73
76
|
DataTableColumnHeader.defaultProps = {
|
|
74
77
|
dataTest: 'dhis2-uicore-datatablecellhead'
|
|
@@ -4,11 +4,12 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import i18n from '../../locales/index.js';
|
|
6
6
|
import { TableHeaderCellAction } from '../table-elements/index.js';
|
|
7
|
-
export const FilterHandle =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const FilterHandle = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
active,
|
|
10
|
+
name,
|
|
11
|
+
onClick
|
|
12
|
+
} = _ref;
|
|
12
13
|
const filterIconColor = active ? colors.blue700 : colors.grey600;
|
|
13
14
|
const clickHandler = onClick ? event => {
|
|
14
15
|
onClick({
|
|
@@ -14,12 +14,13 @@ export const getNextSortDirection = currentDirection => {
|
|
|
14
14
|
const nextIndex = (currentIndex + 1) % SORT_DIRECTIONS.length;
|
|
15
15
|
return SORT_DIRECTIONS[nextIndex];
|
|
16
16
|
};
|
|
17
|
-
export const Sorter =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
export const Sorter = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
name,
|
|
20
|
+
sortDirection,
|
|
21
|
+
title,
|
|
22
|
+
onClick
|
|
23
|
+
} = _ref;
|
|
23
24
|
const nextSortDirection = getNextSortDirection(sortDirection);
|
|
24
25
|
const clickHandler = onClick ? event => {
|
|
25
26
|
onClick({
|
|
@@ -49,7 +50,7 @@ export const Sorter = ({
|
|
|
49
50
|
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
50
51
|
id: "884818973",
|
|
51
52
|
dynamic: [colors.grey500, colors.blue700]
|
|
52
|
-
}, [
|
|
53
|
+
}, ["svg.__jsx-style-dynamic-selector .top.__jsx-style-dynamic-selector,svg.__jsx-style-dynamic-selector .bottom.__jsx-style-dynamic-selector{fill:".concat(colors.grey500, ";}"), "svg.asc.__jsx-style-dynamic-selector .top.__jsx-style-dynamic-selector,svg.desc.__jsx-style-dynamic-selector .bottom.__jsx-style-dynamic-selector{fill:".concat(colors.blue700, ";}")]));
|
|
53
54
|
};
|
|
54
55
|
Sorter.propTypes = {
|
|
55
56
|
name: PropTypes.string,
|
|
@@ -7,17 +7,18 @@ import resolvedCss from './data-table-row.styles.js';
|
|
|
7
7
|
import { DragHandleCell } from './drag-handle-cell.js';
|
|
8
8
|
import { ExpandHandleCell } from './expand-handle-cell.js';
|
|
9
9
|
import { ExpandedRow } from './expanded-row.js';
|
|
10
|
-
export const DataTableRow = /*#__PURE__*/forwardRef(({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
export const DataTableRow = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
dataTest,
|
|
15
|
+
expandableContent,
|
|
16
|
+
expanded,
|
|
17
|
+
selected,
|
|
18
|
+
draggable,
|
|
19
|
+
role,
|
|
20
|
+
onExpandToggle
|
|
21
|
+
} = _ref;
|
|
21
22
|
const [isHoveringExpandedContent, setIsHoveringExpandedContent] = useState(false);
|
|
22
23
|
const classes = cx(className, resolvedCss.className, {
|
|
23
24
|
expanded,
|
|
@@ -4,6 +4,6 @@ import { colors } from '@dhis2/ui-constants';
|
|
|
4
4
|
export default {
|
|
5
5
|
styles: /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
6
6
|
id: "1795567040"
|
|
7
|
-
}, [
|
|
7
|
+
}, ["tr.isHoveringExpandedContent.jsx-1795567040>td{background-color:".concat(colors.grey100, ";}"), "tr.isHoveringExpandedContent.jsx-1795567040>th{background-color:".concat(colors.grey300, ";}"), "tr.selected.isHoveringExpandedContent.jsx-1795567040>td{background-color:#cdeae8;}", "tr.expanded.jsx-1795567040>td{border-bottom-color:transparent;}", "tr.expanded.jsx-1795567040>td.bordered{border-bottom-color:".concat(colors.grey300, ";}")]),
|
|
8
8
|
className: "jsx-1795567040"
|
|
9
9
|
};
|
|
@@ -10,18 +10,21 @@ const pointer = {
|
|
|
10
10
|
}, ["td.jsx-927553068{cursor:pointer;}"]),
|
|
11
11
|
className: "jsx-927553068"
|
|
12
12
|
};
|
|
13
|
-
export const ExpandHandleCell =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
13
|
+
export const ExpandHandleCell = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
expanded,
|
|
16
|
+
onClick
|
|
17
|
+
} = _ref;
|
|
18
|
+
return /*#__PURE__*/React.createElement(TableDataCell, {
|
|
19
|
+
className: cx(pointer.className, {
|
|
20
|
+
expanded
|
|
21
|
+
}),
|
|
22
|
+
onClick: () => onClick({
|
|
23
|
+
expanded: !expanded
|
|
24
|
+
}),
|
|
25
|
+
width: "48px"
|
|
26
|
+
}, expanded ? /*#__PURE__*/React.createElement(IconChevronUp24, null) : /*#__PURE__*/React.createElement(IconChevronDown24, null), pointer.styles);
|
|
27
|
+
};
|
|
25
28
|
ExpandHandleCell.propTypes = {
|
|
26
29
|
expanded: PropTypes.bool,
|
|
27
30
|
onClick: PropTypes.func
|
|
@@ -10,28 +10,31 @@ const {
|
|
|
10
10
|
} = {
|
|
11
11
|
styles: /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
12
12
|
id: "626485122"
|
|
13
|
-
}, [
|
|
13
|
+
}, ["tr.expanded:hover+tr>td.jsx-626485122{background-color:".concat(colors.grey100, ";}"), "tr.expanded:active+tr>td.jsx-626485122{background-color:".concat(colors.grey200, ";}"), "tr.selected.expanded:hover+tr.jsx-626485122>td.jsx-626485122{background-color:#cdeae8;}"]),
|
|
14
14
|
className: "jsx-626485122"
|
|
15
15
|
};
|
|
16
|
-
export const ExpandedRow =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
export const ExpandedRow = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
colSpan,
|
|
21
|
+
dataTest,
|
|
22
|
+
selected,
|
|
23
|
+
setIsHoveringExpandedContent
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/React.createElement(TableRow, {
|
|
26
|
+
onMouseOver: () => setIsHoveringExpandedContent(true),
|
|
27
|
+
onMouseOut: () => setIsHoveringExpandedContent(false),
|
|
28
|
+
className: cx({
|
|
29
|
+
["".concat(className, "-expandedrow")]: !!className
|
|
30
|
+
}),
|
|
31
|
+
selected: selected,
|
|
32
|
+
dataTest: dataTest && "".concat(dataTest, "-expandedrow")
|
|
33
|
+
}, /*#__PURE__*/React.createElement(TableDataCell, {
|
|
34
|
+
className: cellClassName,
|
|
35
|
+
colSpan: colSpan
|
|
36
|
+
}, children, styles));
|
|
37
|
+
};
|
|
35
38
|
ExpandedRow.propTypes = {
|
|
36
39
|
children: PropTypes.node,
|
|
37
40
|
className: PropTypes.string,
|
|
@@ -2,16 +2,17 @@ import cx from 'classnames';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { forwardRef } from 'react';
|
|
4
4
|
import { Table, TableScrollBox } from './table-elements/index.js';
|
|
5
|
-
export const DataTable = /*#__PURE__*/forwardRef(({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
export const DataTable = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
dataTest,
|
|
10
|
+
layout,
|
|
11
|
+
role,
|
|
12
|
+
scrollHeight,
|
|
13
|
+
scrollWidth,
|
|
14
|
+
width
|
|
15
|
+
} = _ref;
|
|
15
16
|
const scrollable = !!(scrollHeight || scrollWidth);
|
|
16
17
|
const table = /*#__PURE__*/React.createElement(Table, {
|
|
17
18
|
borderless: scrollable,
|
|
@@ -24,7 +25,7 @@ export const DataTable = /*#__PURE__*/forwardRef(({
|
|
|
24
25
|
}, children);
|
|
25
26
|
return !scrollable ? table : /*#__PURE__*/React.createElement(TableScrollBox, {
|
|
26
27
|
className: cx(className, 'tablescrollbox'),
|
|
27
|
-
dataTest:
|
|
28
|
+
dataTest: "".concat(dataTest, "-scrollbox"),
|
|
28
29
|
maxHeight: scrollHeight,
|
|
29
30
|
maxWidth: scrollWidth
|
|
30
31
|
}, table);
|