@atlaskit/dynamic-table 14.3.1 → 14.4.2
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 +34 -0
- package/README.md +2 -2
- package/dist/cjs/components/LoadingContainerAdvanced.js +3 -3
- package/dist/cjs/components/Stateful.js +26 -0
- package/dist/cjs/components/Stateless.js +2 -2
- package/dist/cjs/components/TableHeadCell.js +18 -48
- package/dist/cjs/components/{managedPagination.js → managed-pagination.js} +0 -0
- package/dist/cjs/components/rankable/TableCell.js +4 -4
- package/dist/cjs/components/rankable/TableHeadCell.js +2 -4
- package/dist/cjs/components/rankable/TableRow.js +3 -3
- package/dist/cjs/internal/constants.js +1 -5
- package/dist/cjs/styled/DynamicTable.js +80 -16
- package/dist/cjs/styled/EmptyBody.js +23 -10
- package/dist/cjs/styled/LoadingContainer.js +41 -8
- package/dist/cjs/styled/LoadingContainerAdvanced.js +42 -8
- package/dist/cjs/styled/TableCell.js +21 -7
- package/dist/cjs/styled/TableHead.js +161 -25
- package/dist/cjs/styled/TableRow.js +36 -18
- package/dist/cjs/styled/constants.js +33 -40
- package/dist/cjs/styled/rankable/RowPlaceholder.js +11 -4
- package/dist/cjs/styled/rankable/TableCell.js +18 -13
- package/dist/cjs/styled/rankable/TableRow.js +32 -20
- package/dist/cjs/theme.js +20 -18
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/LoadingContainerAdvanced.js +2 -4
- package/dist/es2019/components/Stateful.js +27 -0
- package/dist/es2019/components/Stateless.js +2 -2
- package/dist/es2019/components/TableHeadCell.js +18 -22
- package/dist/es2019/components/{managedPagination.js → managed-pagination.js} +0 -0
- package/dist/es2019/components/rankable/TableCell.js +4 -4
- package/dist/es2019/components/rankable/TableHeadCell.js +1 -3
- package/dist/es2019/components/rankable/TableRow.js +3 -3
- package/dist/es2019/internal/constants.js +0 -2
- package/dist/es2019/styled/DynamicTable.js +75 -27
- package/dist/es2019/styled/EmptyBody.js +21 -11
- package/dist/es2019/styled/LoadingContainer.js +39 -18
- package/dist/es2019/styled/LoadingContainerAdvanced.js +38 -20
- package/dist/es2019/styled/TableCell.js +20 -5
- package/dist/es2019/styled/TableHead.js +160 -33
- package/dist/es2019/styled/TableRow.js +34 -20
- package/dist/es2019/styled/constants.js +30 -116
- package/dist/es2019/styled/rankable/RowPlaceholder.js +10 -4
- package/dist/es2019/styled/rankable/TableCell.js +16 -9
- package/dist/es2019/styled/rankable/TableRow.js +32 -24
- package/dist/es2019/theme.js +19 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/LoadingContainerAdvanced.js +3 -3
- package/dist/esm/components/Stateful.js +26 -0
- package/dist/esm/components/Stateless.js +2 -2
- package/dist/esm/components/TableHeadCell.js +19 -47
- package/dist/esm/components/{managedPagination.js → managed-pagination.js} +0 -0
- package/dist/esm/components/rankable/TableCell.js +4 -4
- package/dist/esm/components/rankable/TableHeadCell.js +2 -4
- package/dist/esm/components/rankable/TableRow.js +3 -3
- package/dist/esm/internal/constants.js +0 -2
- package/dist/esm/styled/DynamicTable.js +77 -10
- package/dist/esm/styled/EmptyBody.js +23 -8
- package/dist/esm/styled/LoadingContainer.js +40 -8
- package/dist/esm/styled/LoadingContainerAdvanced.js +41 -7
- package/dist/esm/styled/TableCell.js +21 -7
- package/dist/esm/styled/TableHead.js +160 -21
- package/dist/esm/styled/TableRow.js +36 -12
- package/dist/esm/styled/constants.js +28 -30
- package/dist/esm/styled/rankable/RowPlaceholder.js +11 -5
- package/dist/esm/styled/rankable/TableCell.js +18 -9
- package/dist/esm/styled/rankable/TableRow.js +31 -14
- package/dist/esm/theme.js +19 -18
- package/dist/esm/version.json +1 -1
- package/dist/types/components/Body.d.ts +21 -21
- package/dist/types/components/LoadingContainer.d.ts +3 -3
- package/dist/types/components/LoadingContainerAdvanced.d.ts +3 -3
- package/dist/types/components/Stateful.d.ts +26 -0
- package/dist/types/components/Stateless.d.ts +3 -3
- package/dist/types/components/TableHeadCell.d.ts +4 -9
- package/dist/types/components/{managedPagination.d.ts → managed-pagination.d.ts} +4 -7
- package/dist/types/components/rankable/Body.d.ts +21 -21
- package/dist/types/components/rankable/TableHeadCell.d.ts +1 -1
- package/dist/types/components/rankable/TableRow.d.ts +3 -3
- package/dist/types/hoc/withDimensions.d.ts +2 -2
- package/dist/types/hoc/withSortedPageRows.d.ts +20 -20
- package/dist/types/internal/constants.d.ts +0 -2
- package/dist/types/styled/DynamicTable.d.ts +13 -6
- package/dist/types/styled/EmptyBody.d.ts +4 -3
- package/dist/types/styled/LoadingContainer.d.ts +8 -7
- package/dist/types/styled/LoadingContainerAdvanced.d.ts +5 -4
- package/dist/types/styled/TableCell.d.ts +3 -2
- package/dist/types/styled/TableHead.d.ts +8 -5
- package/dist/types/styled/TableRow.d.ts +7 -4
- package/dist/types/styled/constants.d.ts +13 -10
- package/dist/types/styled/rankable/RowPlaceholder.d.ts +3 -2
- package/dist/types/styled/rankable/TableCell.d.ts +8 -6
- package/dist/types/styled/rankable/TableRow.d.ts +9 -6
- package/dist/types/theme.d.ts +9 -9
- package/dist/types/types.d.ts +76 -37
- package/package.json +16 -9
|
@@ -1,13 +1,80 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
9
|
+
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
10
|
+
import { row } from '../theme';
|
|
11
|
+
var gridSize = getGridSize();
|
|
12
|
+
// CSS vars for table row
|
|
13
|
+
// these are declared here to avoid being re-declared in each table row
|
|
14
|
+
export var tableRowCSSVars = {
|
|
15
|
+
CSS_VAR_HOVER_BACKGROUND: '--local-dynamic-table-hover-bg',
|
|
16
|
+
CSS_VAR_HIGHLIGHTED_BACKGROUND: '--local-dynamic-table-highlighted-bg',
|
|
17
|
+
CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND: '--local-dynamic-table-hover-highlighted-bg',
|
|
18
|
+
CSS_VAR_ROW_FOCUS_OUTLINE: '--local-dynamic-table-row-focus-outline'
|
|
19
|
+
};
|
|
20
|
+
var fixedSizeTableStyles = css({
|
|
21
|
+
tableLayout: 'fixed'
|
|
22
|
+
});
|
|
23
|
+
var tableStyles = css({
|
|
24
|
+
borderCollapse: 'collapse',
|
|
25
|
+
width: '100%'
|
|
26
|
+
});
|
|
27
|
+
export var Table = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
28
|
+
var _ref2;
|
|
29
|
+
|
|
30
|
+
var isFixedSize = _ref.isFixedSize,
|
|
31
|
+
children = _ref.children,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, ["isFixedSize", "children"]);
|
|
4
33
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
34
|
+
var theme = useGlobalTheme();
|
|
35
|
+
return jsx("table", _extends({
|
|
36
|
+
style: (_ref2 = {}, _defineProperty(_ref2, tableRowCSSVars.CSS_VAR_HOVER_BACKGROUND, row.hoverBackground({
|
|
37
|
+
theme: theme
|
|
38
|
+
})), _defineProperty(_ref2, tableRowCSSVars.CSS_VAR_HIGHLIGHTED_BACKGROUND, row.highlightedBackground({
|
|
39
|
+
theme: theme
|
|
40
|
+
})), _defineProperty(_ref2, tableRowCSSVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND, row.hoverHighlightedBackground({
|
|
41
|
+
theme: theme
|
|
42
|
+
})), _defineProperty(_ref2, tableRowCSSVars.CSS_VAR_ROW_FOCUS_OUTLINE, row.focusOutline({
|
|
43
|
+
theme: theme
|
|
44
|
+
})), _ref2),
|
|
45
|
+
css: [tableStyles, isFixedSize && fixedSizeTableStyles],
|
|
46
|
+
ref: ref
|
|
47
|
+
}, rest), children);
|
|
48
|
+
});
|
|
49
|
+
var captionStyles = css({
|
|
50
|
+
fontSize: '1.42857143em',
|
|
51
|
+
|
|
52
|
+
/* there is a bug in Safari: if element which creates a new stacking context
|
|
53
|
+
is a child of a table, table caption re-renders in bad wrong position
|
|
54
|
+
https://stackoverflow.com/questions/44009186/safari-bug-translating-table-row-group-using-gsap-make-caption-jump-to-bottom
|
|
55
|
+
*/
|
|
56
|
+
willChange: 'transform',
|
|
57
|
+
fontStyle: 'inherit',
|
|
58
|
+
fontWeight: 500,
|
|
59
|
+
letterSpacing: '-0.008em',
|
|
60
|
+
lineHeight: 1.2,
|
|
61
|
+
marginBottom: "".concat(gridSize, "px"),
|
|
62
|
+
marginTop: "".concat(gridSize * 3.5, "px"),
|
|
63
|
+
textAlign: 'left'
|
|
64
|
+
});
|
|
65
|
+
export var Caption = function Caption(_ref3) {
|
|
66
|
+
var children = _ref3.children;
|
|
67
|
+
return jsx("caption", {
|
|
68
|
+
css: captionStyles
|
|
69
|
+
}, children);
|
|
70
|
+
};
|
|
71
|
+
var paginationWrapperStyles = css({
|
|
72
|
+
display: 'flex',
|
|
73
|
+
justifyContent: 'center'
|
|
11
74
|
});
|
|
12
|
-
export var
|
|
13
|
-
|
|
75
|
+
export var PaginationWrapper = function PaginationWrapper(_ref4) {
|
|
76
|
+
var children = _ref4.children;
|
|
77
|
+
return jsx("div", {
|
|
78
|
+
css: paginationWrapperStyles
|
|
79
|
+
}, children);
|
|
80
|
+
};
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _templateObject, _templateObject2;
|
|
4
|
-
|
|
5
|
-
import styled from 'styled-components';
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
6
3
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var fixedHeightStyles = css({
|
|
5
|
+
height: "".concat(gridSize() * 18, "px")
|
|
6
|
+
});
|
|
7
|
+
export var EmptyViewWithFixedHeight = function EmptyViewWithFixedHeight(_ref) {
|
|
8
|
+
var children = _ref.children;
|
|
9
|
+
return jsx("div", {
|
|
10
|
+
css: fixedHeightStyles
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
13
|
+
var emptyViewContainerStyles = css({
|
|
14
|
+
margin: 'auto',
|
|
15
|
+
padding: '10px',
|
|
16
|
+
textAlign: 'center',
|
|
17
|
+
width: '50%'
|
|
18
|
+
});
|
|
19
|
+
export var EmptyViewContainer = function EmptyViewContainer(_ref2) {
|
|
20
|
+
var children = _ref2.children;
|
|
21
|
+
return jsx("div", {
|
|
22
|
+
css: emptyViewContainerStyles
|
|
23
|
+
}, children);
|
|
24
|
+
};
|
|
@@ -1,10 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
var CSS_VAR_CONTENTS_OPACITY = '--contents-opacity';
|
|
6
|
+
var containerStyles = css({
|
|
7
|
+
position: 'relative'
|
|
8
|
+
});
|
|
9
|
+
export var Container = function Container(_ref) {
|
|
10
|
+
var children = _ref.children;
|
|
11
|
+
return jsx("div", {
|
|
12
|
+
css: containerStyles
|
|
13
|
+
}, children);
|
|
14
|
+
};
|
|
15
|
+
var contentsContainerStyles = css({
|
|
16
|
+
pointerEvents: 'none',
|
|
17
|
+
opacity: "var(".concat(CSS_VAR_CONTENTS_OPACITY, ")")
|
|
18
|
+
});
|
|
19
|
+
export var ContentsContainer = function ContentsContainer(_ref2) {
|
|
20
|
+
var contentsOpacity = _ref2.contentsOpacity,
|
|
21
|
+
children = _ref2.children;
|
|
22
|
+
return jsx("div", {
|
|
23
|
+
style: _defineProperty({}, CSS_VAR_CONTENTS_OPACITY, contentsOpacity),
|
|
24
|
+
css: [contentsContainerStyles]
|
|
25
|
+
}, children);
|
|
26
|
+
};
|
|
27
|
+
var spinnerContainerStyles = css({
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: 0,
|
|
30
|
+
right: 0,
|
|
31
|
+
bottom: 0,
|
|
32
|
+
left: 0,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center'
|
|
9
36
|
});
|
|
10
|
-
export var SpinnerContainer =
|
|
37
|
+
export var SpinnerContainer = function SpinnerContainer(_ref4) {
|
|
38
|
+
var children = _ref4.children;
|
|
39
|
+
return jsx("div", {
|
|
40
|
+
css: spinnerContainerStyles
|
|
41
|
+
}, children);
|
|
42
|
+
};
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var containerStyles = css({
|
|
8
|
+
marginBottom: "".concat(gridSize() * 3, "px"),
|
|
9
|
+
position: 'relative'
|
|
10
|
+
});
|
|
11
|
+
export var Container = function Container(props) {
|
|
12
|
+
return jsx("div", _extends({
|
|
13
|
+
css: containerStyles
|
|
14
|
+
}, props));
|
|
15
|
+
};
|
|
16
|
+
var spinnerBackdropStyles = css({
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
top: 0,
|
|
20
|
+
right: 0,
|
|
21
|
+
bottom: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center'
|
|
26
|
+
});
|
|
27
|
+
export var SpinnerBackdrop = function SpinnerBackdrop(_ref) {
|
|
28
|
+
var children = _ref.children;
|
|
29
|
+
return jsx("div", {
|
|
30
|
+
css: spinnerBackdropStyles
|
|
31
|
+
}, children);
|
|
32
|
+
};
|
|
33
|
+
var spinnerContainerStyles = css({
|
|
34
|
+
position: 'relative',
|
|
35
|
+
top: 0
|
|
36
|
+
});
|
|
37
|
+
export var SpinnerContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
38
|
+
var children = _ref2.children;
|
|
39
|
+
return jsx("div", {
|
|
40
|
+
css: spinnerContainerStyles,
|
|
41
|
+
ref: ref
|
|
42
|
+
}, children);
|
|
43
|
+
});
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
|
|
7
|
+
export var TableBodyCell = function TableBodyCell(_ref) {
|
|
8
|
+
var width = _ref.width,
|
|
9
|
+
isFixedSize = _ref.isFixedSize,
|
|
10
|
+
shouldTruncate = _ref.shouldTruncate,
|
|
11
|
+
innerRef = _ref.innerRef,
|
|
12
|
+
props = _objectWithoutProperties(_ref, ["width", "isFixedSize", "shouldTruncate", "innerRef"]);
|
|
4
13
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
return jsx("td", _extends({
|
|
15
|
+
style: getTruncationStyleVars({
|
|
16
|
+
width: width
|
|
17
|
+
}),
|
|
18
|
+
css: [truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, cellStyles] // HOC withDimensions complains about the types but it is working fine
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
,
|
|
21
|
+
ref: innerRef
|
|
22
|
+
}, props));
|
|
23
|
+
};
|
|
@@ -1,23 +1,162 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
+
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
import { forwardRef } from 'react';
|
|
11
|
+
import { css, jsx } from '@emotion/core';
|
|
12
|
+
import { B100, N30A } from '@atlaskit/theme/colors';
|
|
13
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
14
|
+
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
15
|
+
import { token } from '@atlaskit/tokens';
|
|
16
|
+
import { ASC, DESC } from '../internal/constants';
|
|
17
|
+
import { arrow, head, MSThemeColors } from '../theme';
|
|
18
|
+
import { cellStyles, fixedSizeTruncateStyles, getTruncationStyleVars, overflowTruncateStyles, truncationWidthStyles } from './constants';
|
|
19
|
+
var gridSize = getGridSize();
|
|
20
|
+
var CSS_VAR_TEXT_COLOR = '--local-dynamic-table-text-color';
|
|
21
|
+
var rankingStyles = css({
|
|
22
|
+
display: 'block'
|
|
13
23
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
|
|
24
|
+
|
|
25
|
+
var getHeadStyles = function getHeadStyles(theme) {
|
|
26
|
+
return css({
|
|
27
|
+
borderBottom: "2px solid ".concat(token('color.border.neutral', head.borderColor({
|
|
28
|
+
theme: theme
|
|
29
|
+
})))
|
|
18
30
|
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export var Head = function Head(_ref) {
|
|
34
|
+
var isRanking = _ref.isRanking,
|
|
35
|
+
props = _objectWithoutProperties(_ref, ["isRanking"]);
|
|
36
|
+
|
|
37
|
+
var theme = useGlobalTheme();
|
|
38
|
+
return jsx("thead", _extends({
|
|
39
|
+
css: [getHeadStyles(theme), isRanking && rankingStyles]
|
|
40
|
+
}, props));
|
|
41
|
+
};
|
|
42
|
+
var headCellStyles = css([cellStyles, {
|
|
43
|
+
border: 'none',
|
|
44
|
+
boxSizing: 'border-box',
|
|
45
|
+
fontSize: '12px',
|
|
46
|
+
fontWeight: 600,
|
|
47
|
+
position: 'relative',
|
|
48
|
+
textAlign: 'left',
|
|
49
|
+
verticalAlign: 'top',
|
|
50
|
+
color: token('color.text.lowEmphasis', "var(".concat(CSS_VAR_TEXT_COLOR, ")")),
|
|
51
|
+
'&:focus': {
|
|
52
|
+
outline: "solid 2px ".concat(token('color.border.focus', B100))
|
|
53
|
+
}
|
|
54
|
+
}]); // this needs to be made static: https://product-fabric.atlassian.net/browse/DSP-2011
|
|
55
|
+
|
|
56
|
+
export var getArrowStyles = function getArrowStyles(isSortable, sortOrder, theme) {
|
|
57
|
+
if (!isSortable) {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var pseudoBaseStyles = {
|
|
62
|
+
border: '3px solid transparent',
|
|
63
|
+
display: 'block',
|
|
64
|
+
height: 0,
|
|
65
|
+
right: "-".concat(gridSize, "px"),
|
|
66
|
+
width: 0,
|
|
67
|
+
'@media (forced-colors: active)': {
|
|
68
|
+
border: "3px solid ".concat(MSThemeColors.Background)
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return css({
|
|
72
|
+
'& > span': {
|
|
73
|
+
position: 'relative',
|
|
74
|
+
'&::before': _objectSpread(_objectSpread({}, pseudoBaseStyles), {}, {
|
|
75
|
+
position: 'absolute',
|
|
76
|
+
borderBottom: "3px solid ".concat(sortOrder === ASC ? arrow.selectedColor({
|
|
77
|
+
theme: theme
|
|
78
|
+
}) : arrow.defaultColor({
|
|
79
|
+
theme: theme
|
|
80
|
+
})),
|
|
81
|
+
bottom: '8px',
|
|
82
|
+
content: '""'
|
|
83
|
+
}),
|
|
84
|
+
'&::after': _objectSpread(_objectSpread({}, pseudoBaseStyles), {}, {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
borderTop: "3px solid ".concat(sortOrder === DESC ? arrow.selectedColor({
|
|
87
|
+
theme: theme
|
|
88
|
+
}) : arrow.defaultColor({
|
|
89
|
+
theme: theme
|
|
90
|
+
})),
|
|
91
|
+
bottom: 0,
|
|
92
|
+
content: '""'
|
|
93
|
+
})
|
|
94
|
+
},
|
|
95
|
+
'&:hover > span': {
|
|
96
|
+
'&::before': {
|
|
97
|
+
borderBottom: "3px solid\n ".concat(sortOrder === ASC ? arrow.selectedColor({
|
|
98
|
+
theme: theme
|
|
99
|
+
}) : arrow.hoverColor({
|
|
100
|
+
theme: theme
|
|
101
|
+
}))
|
|
102
|
+
},
|
|
103
|
+
'&::after': {
|
|
104
|
+
borderTop: "3px solid\n ".concat(sortOrder === DESC ? arrow.selectedColor({
|
|
105
|
+
theme: theme
|
|
106
|
+
}) : arrow.hoverColor({
|
|
107
|
+
theme: theme
|
|
108
|
+
}))
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
'@media (forced-colors: active)': {
|
|
112
|
+
'& > span': {
|
|
113
|
+
'&::before': {
|
|
114
|
+
borderBottom: "3px solid\n ".concat(sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
|
|
115
|
+
},
|
|
116
|
+
'&::after': {
|
|
117
|
+
borderTop: "3px solid\n ".concat(sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
'&:hover > span': {
|
|
121
|
+
'&::before': {
|
|
122
|
+
borderBottom: "3px solid\n ".concat(sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
|
|
123
|
+
},
|
|
124
|
+
'&::after': {
|
|
125
|
+
borderTop: "3px solid\n ".concat(sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
var onClickStyles = css({
|
|
132
|
+
'&:hover': {
|
|
133
|
+
cursor: 'pointer',
|
|
134
|
+
backgroundColor: token('color.background.subtleNeutral.hover', N30A)
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
export var HeadCell = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
138
|
+
var width = _ref2.width,
|
|
139
|
+
children = _ref2.children,
|
|
140
|
+
isSortable = _ref2.isSortable,
|
|
141
|
+
sortOrder = _ref2.sortOrder,
|
|
142
|
+
isFixedSize = _ref2.isFixedSize,
|
|
143
|
+
shouldTruncate = _ref2.shouldTruncate,
|
|
144
|
+
onClick = _ref2.onClick,
|
|
145
|
+
style = _ref2.style,
|
|
146
|
+
rest = _objectWithoutProperties(_ref2, ["width", "children", "isSortable", "sortOrder", "isFixedSize", "shouldTruncate", "onClick", "style"]);
|
|
147
|
+
|
|
148
|
+
var theme = useGlobalTheme();
|
|
149
|
+
|
|
150
|
+
var mergedStyles = _objectSpread(_objectSpread(_objectSpread({}, style), width && getTruncationStyleVars({
|
|
151
|
+
width: width
|
|
152
|
+
})), {}, _defineProperty({}, CSS_VAR_TEXT_COLOR, head.textColor({
|
|
153
|
+
theme: theme
|
|
154
|
+
})));
|
|
155
|
+
|
|
156
|
+
return jsx("th", _extends({
|
|
157
|
+
style: mergedStyles,
|
|
158
|
+
css: [headCellStyles, onClick && onClickStyles, truncationWidthStyles, isFixedSize && shouldTruncate && fixedSizeTruncateStyles, isFixedSize && overflowTruncateStyles, getArrowStyles(isSortable, sortOrder, theme)],
|
|
159
|
+
onClick: onClick,
|
|
160
|
+
ref: ref
|
|
161
|
+
}, rest), children);
|
|
162
|
+
});
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
8
|
+
import { tableRowCSSVars as cssVars } from './DynamicTable';
|
|
9
|
+
var rowStyles = css({
|
|
10
|
+
'&:focus': {
|
|
11
|
+
outline: "2px solid ".concat(token('color.border.focus', "var(".concat(cssVars.CSS_VAR_HOVER_BACKGROUND, ")"))),
|
|
12
|
+
outlineOffset: "-2px"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var rowBackgroundStyles = css({
|
|
16
|
+
'&:hover': {
|
|
17
|
+
backgroundColor: token('color.background.transparentNeutral.hover', "var(".concat(cssVars.CSS_VAR_HOVER_BACKGROUND, ")"))
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var rowHighlightedBackgroundStyles = css({
|
|
21
|
+
backgroundColor: token('color.background.selected.resting', "var(".concat(cssVars.CSS_VAR_HIGHLIGHTED_BACKGROUND, ")")),
|
|
22
|
+
'&:hover': {
|
|
23
|
+
backgroundColor: token('color.background.selected.hover', "var(".concat(cssVars.CSS_VAR_HOVER_HIGHLIGHTED_BACKGROUND, ")"))
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export var TableBodyRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
|
+
var isHighlighted = _ref.isHighlighted,
|
|
28
|
+
children = _ref.children,
|
|
29
|
+
style = _ref.style,
|
|
30
|
+
rest = _objectWithoutProperties(_ref, ["isHighlighted", "children", "style"]);
|
|
4
31
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
var isHighlighted = _ref2.isHighlighted;
|
|
13
|
-
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), isHighlighted ? row.hoverHighlightedBackground : row.hoverBackground);
|
|
14
|
-
}, outlineWidth, row.focusOutline, outlineWidth);
|
|
32
|
+
return jsx("tr", _extends({
|
|
33
|
+
style: style,
|
|
34
|
+
css: [rowStyles, isHighlighted ? rowHighlightedBackgroundStyles : rowBackgroundStyles]
|
|
35
|
+
}, rest, {
|
|
36
|
+
ref: ref
|
|
37
|
+
}), children);
|
|
38
|
+
});
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { css } from '@emotion/core';
|
|
3
|
+
import { gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
4
|
+
var CSS_VAR_WIDTH = '--local-dynamic-table-width';
|
|
5
|
+
var gridSize = getGridSize();
|
|
6
|
+
export var truncationWidthStyles = css({
|
|
7
|
+
width: "var(".concat(CSS_VAR_WIDTH, ")")
|
|
8
|
+
});
|
|
9
|
+
export var fixedSizeTruncateStyles = css({
|
|
10
|
+
textOverflow: 'ellipsis',
|
|
11
|
+
whiteSpace: 'nowrap'
|
|
12
|
+
});
|
|
13
|
+
export var overflowTruncateStyles = css({
|
|
14
|
+
overflow: 'hidden'
|
|
15
|
+
});
|
|
16
|
+
export var getTruncationStyleVars = function getTruncationStyleVars(_ref) {
|
|
17
|
+
var width = _ref.width;
|
|
18
|
+
return _defineProperty({}, CSS_VAR_WIDTH, typeof width !== 'undefined' ? "".concat(width, "%") : undefined);
|
|
16
19
|
};
|
|
17
|
-
export var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return '';
|
|
20
|
+
export var cellStyles = css({
|
|
21
|
+
border: 'none',
|
|
22
|
+
padding: "".concat(gridSize / 2, "px ").concat(gridSize, "px"),
|
|
23
|
+
textAlign: 'left',
|
|
24
|
+
'&:first-of-type': {
|
|
25
|
+
paddingLeft: 0
|
|
26
|
+
},
|
|
27
|
+
'&:last-child': {
|
|
28
|
+
paddingRight: 0
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
var pseudoBase = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border: 3px solid transparent;\n display: block;\n height: 0;\n position: absolute;\n right: -", "px;\n width: 0;\n\n @media (forced-colors: active) {\n border: 3px solid ", ";\n }\n "])), gridSize, MSThemeColors.Background);
|
|
30
|
-
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n & > span {\n position: relative;\n &::before {\n ", ";\n border-bottom: 3px solid\n ", ";\n bottom: 8px;\n content: ' ';\n }\n &::after {\n ", ";\n border-top: 3px solid\n ", ";\n bottom: 0;\n content: ' ';\n }\n }\n\n &:hover > span {\n &::before {\n border-bottom: 3px solid\n ", ";\n }\n &::after {\n border-top: 3px solid\n ", ";\n }\n }\n\n @media (forced-colors: active) {\n & > span {\n &::before {\n border-bottom: 3px solid\n ", ";\n }\n &::after {\n border-top: 3px solid\n ", ";\n }\n }\n\n &:hover > span {\n &::before {\n border-bottom: 3px solid\n ", ";\n }\n &::after {\n border-top: 3px solid\n ", ";\n }\n }\n }\n "])), pseudoBase, sortOrder === ASC ? arrow.selectedColor(props) : arrow.defaultColor(props), pseudoBase, sortOrder === DESC ? arrow.selectedColor(props) : arrow.defaultColor(props), sortOrder === ASC ? arrow.selectedColor(props) : arrow.hoverColor(props), sortOrder === DESC ? arrow.selectedColor(props) : arrow.hoverColor(props), sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text, sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text, sortOrder === ASC ? MSThemeColors.SelectedBackground : MSThemeColors.Text, sortOrder === DESC ? MSThemeColors.SelectedBackground : MSThemeColors.Text);
|
|
31
|
-
};
|
|
32
|
-
export var cellStyle = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border: none;\n padding: ", "px ", "px;\n text-align: left;\n\n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"])), divide(gridSize, 2), gridSize);
|
|
30
|
+
});
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
var rowPlaceholderStyles = css({
|
|
6
|
+
padding: 0
|
|
7
|
+
});
|
|
8
|
+
export var RowPlaceholderCell = function RowPlaceholderCell(props) {
|
|
9
|
+
return jsx("td", _extends({
|
|
10
|
+
css: rowPlaceholderStyles
|
|
11
|
+
}, props));
|
|
12
|
+
};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import { TableBodyCell } from '../TableCell';
|
|
7
|
-
var rankingStyles = css(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
var rankingStyles = css({
|
|
8
|
+
boxSizing: 'border-box'
|
|
9
|
+
});
|
|
10
|
+
export var RankableTableBodyCell = function RankableTableBodyCell(_ref) {
|
|
11
|
+
var isRanking = _ref.isRanking,
|
|
12
|
+
innerRef = _ref.innerRef,
|
|
13
|
+
props = _objectWithoutProperties(_ref, ["isRanking", "innerRef"]);
|
|
14
|
+
|
|
15
|
+
return jsx(TableBodyCell, _extends({
|
|
16
|
+
css: isRanking && rankingStyles
|
|
17
|
+
}, props, {
|
|
18
|
+
innerRef: innerRef
|
|
19
|
+
}));
|
|
20
|
+
};
|