@atlaskit/link-datasource 1.22.8 → 1.23.0
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 +6 -0
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/cjs/ui/issue-like-table/custom-icons.js +55 -0
- package/dist/cjs/ui/issue-like-table/drag-column-preview.js +20 -5
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +72 -13
- package/dist/cjs/ui/issue-like-table/index.js +70 -15
- package/dist/cjs/ui/issue-like-table/messages.js +19 -0
- package/dist/cjs/ui/issue-like-table/render-type/date-time/index.js +3 -3
- package/dist/cjs/ui/issue-like-table/render-type/link/index.js +1 -1
- package/dist/cjs/ui/issue-like-table/render-type/richtext/index.js +0 -3
- package/dist/cjs/ui/issue-like-table/render-type/text/index.js +3 -3
- package/dist/cjs/ui/issue-like-table/render-type/user/index.js +8 -5
- package/dist/cjs/ui/issue-like-table/styled.js +34 -6
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/es2019/ui/issue-like-table/custom-icons.js +42 -0
- package/dist/es2019/ui/issue-like-table/drag-column-preview.js +19 -18
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +58 -11
- package/dist/es2019/ui/issue-like-table/index.js +75 -62
- package/dist/es2019/ui/issue-like-table/messages.js +13 -0
- package/dist/es2019/ui/issue-like-table/render-type/date-time/index.js +4 -4
- package/dist/es2019/ui/issue-like-table/render-type/link/index.js +2 -2
- package/dist/es2019/ui/issue-like-table/render-type/richtext/index.js +0 -3
- package/dist/es2019/ui/issue-like-table/render-type/text/index.js +4 -4
- package/dist/es2019/ui/issue-like-table/render-type/user/index.js +6 -6
- package/dist/es2019/ui/issue-like-table/styled.js +36 -56
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/esm/ui/issue-like-table/custom-icons.js +48 -0
- package/dist/esm/ui/issue-like-table/drag-column-preview.js +19 -5
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +66 -11
- package/dist/esm/ui/issue-like-table/index.js +71 -16
- package/dist/esm/ui/issue-like-table/messages.js +13 -0
- package/dist/esm/ui/issue-like-table/render-type/date-time/index.js +4 -4
- package/dist/esm/ui/issue-like-table/render-type/link/index.js +2 -2
- package/dist/esm/ui/issue-like-table/render-type/richtext/index.js +0 -3
- package/dist/esm/ui/issue-like-table/render-type/text/index.js +4 -4
- package/dist/esm/ui/issue-like-table/render-type/user/index.js +7 -5
- package/dist/esm/ui/issue-like-table/styled.js +33 -5
- package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +6 -2
- package/dist/types/ui/datasource-table-view/types.d.ts +3 -14
- package/dist/types/ui/issue-like-table/custom-icons.d.ts +5 -0
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +7 -3
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/messages.d.ts +12 -0
- package/dist/types/ui/issue-like-table/styled.d.ts +1 -1
- package/dist/types/ui/issue-like-table/types.d.ts +18 -2
- package/dist/types-ts4.5/ui/datasource-table-view/datasourceTableView.d.ts +6 -2
- package/dist/types-ts4.5/ui/datasource-table-view/types.d.ts +3 -14
- package/dist/types-ts4.5/ui/issue-like-table/custom-icons.d.ts +5 -0
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +7 -3
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +12 -0
- package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +18 -2
- package/examples-helpers/buildIssueLikeTable.tsx +26 -24
- package/examples-helpers/buildJiraIssuesTable.tsx +17 -22
- package/examples-helpers/useCommonTableProps.tsx +57 -0
- package/package.json +2 -2
|
@@ -4,14 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.
|
|
8
|
-
var
|
|
7
|
+
exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.fieldTextFontSize = exports.TableHeading = exports.Table = exports.ScrollableContainerHeight = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
-
var
|
|
11
|
+
var _styled$th;
|
|
12
12
|
var ScrollableContainerHeight = exports.ScrollableContainerHeight = 590;
|
|
13
|
-
var
|
|
14
|
-
var Table = exports.Table = _styled.default.table(
|
|
13
|
+
var fieldTextFontSize = exports.fieldTextFontSize = "var(--ds-font-size-100, 14px)";
|
|
14
|
+
var Table = exports.Table = _styled.default.table({
|
|
15
|
+
width: '100%'
|
|
16
|
+
});
|
|
15
17
|
var lineHeight = "var(--ds-font-lineHeight-300, 24px)";
|
|
16
18
|
var verticalPadding = "var(--ds-space-025, 2px)";
|
|
17
19
|
|
|
@@ -27,4 +29,30 @@ var withTablePluginPrefix = exports.withTablePluginPrefix = function withTablePl
|
|
|
27
29
|
};
|
|
28
30
|
var withTablePluginHeaderPrefix = exports.withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
|
|
29
31
|
var withTablePluginBodyPrefix = exports.withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
|
|
30
|
-
var TableHeading = exports.TableHeading = _styled.default.th(
|
|
32
|
+
var TableHeading = exports.TableHeading = _styled.default.th((_styled$th = {}, (0, _defineProperty2.default)(_styled$th, "".concat(withTablePluginHeaderPrefix()), {
|
|
33
|
+
border: 0,
|
|
34
|
+
position: 'relative',
|
|
35
|
+
boxSizing: 'border-box',
|
|
36
|
+
lineHeight: lineHeight,
|
|
37
|
+
padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
|
|
38
|
+
borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
39
|
+
borderBottom: "2px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
40
|
+
height: "calc(".concat(lineHeight, " * 2 + ").concat(verticalPadding, " * 4 + 2px)"),
|
|
41
|
+
verticalAlign: 'bottom',
|
|
42
|
+
backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
|
|
43
|
+
}), (0, _defineProperty2.default)(_styled$th, "".concat(withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)')), {
|
|
44
|
+
borderRight: 0
|
|
45
|
+
}), (0, _defineProperty2.default)(_styled$th, "".concat(withTablePluginHeaderPrefix('&:first-child')), {
|
|
46
|
+
paddingLeft: "var(--ds-space-050, 4px)"
|
|
47
|
+
}), (0, _defineProperty2.default)(_styled$th, "".concat(withTablePluginHeaderPrefix('&:last-child')), {
|
|
48
|
+
borderRight: 0
|
|
49
|
+
}), (0, _defineProperty2.default)(_styled$th, "& [data-testid='datasource-header-content--container']", {
|
|
50
|
+
width: '100%',
|
|
51
|
+
padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
|
|
52
|
+
display: '-webkit-box',
|
|
53
|
+
WebkitLineClamp: 2,
|
|
54
|
+
WebkitBoxOrient: 'vertical',
|
|
55
|
+
whiteSpace: 'normal',
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
wordWrap: 'break-word'
|
|
58
|
+
}), _styled$th));
|
|
@@ -30,7 +30,9 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
30
30
|
onVisibleColumnKeysChange,
|
|
31
31
|
url,
|
|
32
32
|
columnCustomSizes,
|
|
33
|
-
onColumnResize
|
|
33
|
+
onColumnResize,
|
|
34
|
+
wrappedColumnKeys,
|
|
35
|
+
onWrappedColumnChange
|
|
34
36
|
}) => {
|
|
35
37
|
const {
|
|
36
38
|
reset,
|
|
@@ -161,6 +163,8 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
161
163
|
onVisibleColumnKeysChange: onVisibleColumnKeysChange,
|
|
162
164
|
columnCustomSizes: columnCustomSizes,
|
|
163
165
|
onColumnResize: onColumnResize,
|
|
166
|
+
wrappedColumnKeys: wrappedColumnKeys,
|
|
167
|
+
onWrappedColumnChange: onWrappedColumnChange,
|
|
164
168
|
scrollableContainerHeight: ScrollableContainerHeight,
|
|
165
169
|
parentContainerRenderInstanceId: tableRenderInstanceId,
|
|
166
170
|
extensionKey: extensionKey
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const GlyphPlaceholder = props => /*#__PURE__*/React.createElement("svg", {
|
|
3
|
+
width: "24",
|
|
4
|
+
height: "24",
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
"data-testid": props['data-testid'],
|
|
7
|
+
"aria-label": props['aria-label'],
|
|
8
|
+
className: props.className
|
|
9
|
+
});
|
|
10
|
+
export const WrapTextIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
width: "24",
|
|
13
|
+
height: "24",
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: "none"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
clipRule: "evenodd",
|
|
19
|
+
d: "M5 6.75C5 6.19772 5.44772 5.75 6 5.75H18C18.5523 5.75 19 6.19772 19 6.75C19 7.30228 18.5523 7.75 18 7.75H6C5.44772 7.75 5 7.30228 5 6.75ZM5 12C5 11.4477 5.44772 11 6 11H11.9996L12 12L12 13H6C5.44772 13 5 12.5523 5 12ZM13 12C13 12.5523 12.5522 13 12 13L12 12L11.9996 11C12.5519 11 13 11.4477 13 12ZM18.25 12C18.8023 12 19.25 12.4477 19.25 13V15.25C19.25 16.9069 17.9069 18.25 16.25 18.25H15.2023L16.0049 19.0352C16.3997 19.4214 16.4066 20.0545 16.0204 20.4493C15.6342 20.8441 15.0011 20.851 14.6063 20.4648L12.0507 17.9648C11.8584 17.7767 11.75 17.519 11.75 17.25C11.75 16.981 11.8584 16.7233 12.0507 16.5352L14.6063 14.0352C15.0011 13.649 15.6342 13.6559 16.0204 14.0507C16.4066 14.4455 16.3997 15.0786 16.0049 15.4648L15.2023 16.25H16.25C16.8023 16.25 17.25 15.8023 17.25 15.25V13C17.25 12.4477 17.6977 12 18.25 12ZM5 17.25C5 16.6977 5.44772 16.25 6 16.25H7.99911C8.55141 16.25 9 16.6977 9 17.25C9 17.8023 8.55228 18.25 7.99999 18.25H6C5.44772 18.25 5 17.8023 5 17.25Z",
|
|
20
|
+
fill: 'currentColor'
|
|
21
|
+
}));
|
|
22
|
+
export const UnwrapTextIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
width: "24",
|
|
25
|
+
height: "24",
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
fill: "none"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
fillRule: "evenodd",
|
|
30
|
+
clipRule: "evenodd",
|
|
31
|
+
d: "M5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071Z",
|
|
32
|
+
fill: "currentColor"
|
|
33
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
34
|
+
d: "M15.4214 5.75H6C5.44772 5.75 5 6.19772 5 6.75C5 7.30228 5.44772 7.75 6 7.75L13.4214 7.75L15.4214 5.75Z",
|
|
35
|
+
fill: "currentColor"
|
|
36
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
d: "M10.1714 11L6 11C5.44772 11 5 11.4477 5 12C5 12.5523 5.44772 13 6 13H8.17139L10.1714 11Z",
|
|
38
|
+
fill: "currentColor"
|
|
39
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
40
|
+
d: "M19.25 13C19.25 12.4477 18.8023 12 18.25 12C17.6977 12 17.25 12.4477 17.25 13V15.25C17.25 15.8023 16.8023 16.25 16.25 16.25H15.2022L16.0048 15.4648C16.3996 15.0786 16.4066 14.4455 16.0204 14.0507C15.6342 13.6559 15.0011 13.649 14.6063 14.0352L12.0507 16.5352C11.8584 16.7233 11.75 16.981 11.75 17.25C11.75 17.519 11.8584 17.7767 12.0507 17.9648L14.6063 20.4648C15.0011 20.851 15.6342 20.8441 16.0204 20.4493C16.4066 20.0545 16.3996 19.4214 16.0048 19.0352L15.2022 18.25H16.25C17.9069 18.25 19.25 16.9069 19.25 15.25V13Z",
|
|
41
|
+
fill: "currentColor"
|
|
42
|
+
}));
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { TableHeading } from './styled';
|
|
6
7
|
const maxWidth = '200px';
|
|
7
8
|
const firstLastChildOverride = `
|
|
@@ -10,28 +11,28 @@ const firstLastChildOverride = `
|
|
|
10
11
|
padding-right: ${"var(--ds-space-100, 8px)"};
|
|
11
12
|
}
|
|
12
13
|
`;
|
|
13
|
-
const TablePreviewHeading = styled(TableHeading)
|
|
14
|
-
overflow: hidden
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
background:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
const TablePreviewHeading = styled(TableHeading)({
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
background: "var(--ds-background-disabled, #091E4224)",
|
|
19
|
+
maxWidth: maxWidth
|
|
20
|
+
}, firstLastChildOverride);
|
|
21
|
+
const TablePreviewCell = styled.td({
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
textOverflow: 'ellipsis',
|
|
24
|
+
whiteSpace: 'nowrap',
|
|
25
|
+
maxWidth: maxWidth,
|
|
26
|
+
padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"}`,
|
|
27
|
+
boxSizing: 'border-box',
|
|
28
|
+
borderBottom: `0.5px solid ${`var(--ds-border, ${N40})`}`,
|
|
29
|
+
height: '30px'
|
|
30
|
+
}, firstLastChildOverride);
|
|
30
31
|
const tableStyles = css({
|
|
31
32
|
background: "var(--ds-surface, #FFF)",
|
|
32
33
|
borderCollapse: 'separate',
|
|
33
34
|
borderSpacing: 0,
|
|
34
|
-
fontSize: "var(--ds-font-size-
|
|
35
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
35
36
|
maxWidth
|
|
36
37
|
});
|
|
37
38
|
export const DragColumnPreview = ({
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/** @jsx jsx */
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import styled from '@emotion/styled';
|
|
4
6
|
import ReactDOM from 'react-dom';
|
|
7
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
5
8
|
import invariant from 'tiny-invariant';
|
|
9
|
+
import Button from '@atlaskit/button/new';
|
|
10
|
+
import DropdownMenu, { DropdownItem } from '@atlaskit/dropdown-menu';
|
|
11
|
+
import ChevronDown from '@atlaskit/icon/glyph/chevron-down';
|
|
12
|
+
import ChevronUp from '@atlaskit/icon/glyph/chevron-up';
|
|
6
13
|
import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
7
14
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box-without-terminal';
|
|
8
15
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
@@ -11,13 +18,21 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/elem
|
|
|
11
18
|
import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
|
|
12
19
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
13
20
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
21
|
+
import { GlyphPlaceholder, UnwrapTextIcon, WrapTextIcon } from './custom-icons';
|
|
22
|
+
import { issueLikeTableMessages } from './messages';
|
|
14
23
|
import { TableHeading } from './styled';
|
|
15
24
|
import { COLUMN_MIN_WIDTH, getWidthCss } from './utils';
|
|
16
|
-
const
|
|
17
|
-
display:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
const DropdownParent = styled.div`
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
& button {
|
|
30
|
+
text-align: left; /* By default button center in the middle without props to control it */
|
|
31
|
+
height: auto; /* By default button is not happy with tall (up to lines in our case) content */
|
|
32
|
+
padding-left: 0px; /* By default button's padding left and right is 8 + 4. We control that 8, so left with 4 that we need. */
|
|
33
|
+
padding-right: 0px;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
21
36
|
const dropTargetStyles = css({
|
|
22
37
|
position: 'absolute',
|
|
23
38
|
top: 0,
|
|
@@ -75,7 +90,9 @@ export const DraggableTableHeading = ({
|
|
|
75
90
|
dndPreviewHeight,
|
|
76
91
|
dragPreview,
|
|
77
92
|
width,
|
|
78
|
-
onWidthChange
|
|
93
|
+
onWidthChange,
|
|
94
|
+
isWrapped,
|
|
95
|
+
onIsWrappedChange
|
|
79
96
|
}) => {
|
|
80
97
|
const mainHeaderCellRef = useRef(null);
|
|
81
98
|
const columnResizeHandleRef = useRef(null);
|
|
@@ -253,6 +270,30 @@ export const DraggableTableHeading = ({
|
|
|
253
270
|
}
|
|
254
271
|
});
|
|
255
272
|
}, [id, index, onWidthChange, state, tableId, width]);
|
|
273
|
+
const [buttonHovered, setButtonHovered] = useState(false);
|
|
274
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
275
|
+
const isWideEnoughToHaveChevron = width > 76;
|
|
276
|
+
const shouldShowTriggerIcon = (buttonHovered || isDropdownOpen) && isWideEnoughToHaveChevron;
|
|
277
|
+
const triggerIcon = useMemo(() => shouldShowTriggerIcon ? isDropdownOpen ? ChevronUp : ChevronDown : isWideEnoughToHaveChevron ? GlyphPlaceholder : undefined, [shouldShowTriggerIcon, isDropdownOpen, isWideEnoughToHaveChevron]);
|
|
278
|
+
const getTriggerButton = useCallback(({
|
|
279
|
+
triggerRef,
|
|
280
|
+
...props
|
|
281
|
+
}) => {
|
|
282
|
+
return jsx(Button, _extends({}, props, {
|
|
283
|
+
testId: `${id}-column-dropdown`,
|
|
284
|
+
shouldFitContainer: true,
|
|
285
|
+
iconAfter: triggerIcon,
|
|
286
|
+
ref: triggerRef,
|
|
287
|
+
appearance: "subtle",
|
|
288
|
+
spacing: "compact",
|
|
289
|
+
onMouseEnter: () => setButtonHovered(true),
|
|
290
|
+
onMouseLeave: () => setButtonHovered(false)
|
|
291
|
+
}), children);
|
|
292
|
+
}, [children, id, triggerIcon]);
|
|
293
|
+
const onDropdownOpenChange = useCallback(({
|
|
294
|
+
isOpen
|
|
295
|
+
}) => setIsDropdownOpen(isOpen), []);
|
|
296
|
+
const toggleWrap = useCallback(() => onIsWrappedChange && onIsWrappedChange(!(isWrapped || false)), [isWrapped, onIsWrappedChange]);
|
|
256
297
|
return jsx(TableHeading, {
|
|
257
298
|
ref: mainHeaderCellRef,
|
|
258
299
|
"data-testid": `${id}-column-heading`,
|
|
@@ -270,7 +311,15 @@ export const DraggableTableHeading = ({
|
|
|
270
311
|
height: `${dndPreviewHeight}px`
|
|
271
312
|
},
|
|
272
313
|
"data-testid": "column-resize-handle"
|
|
273
|
-
}) : null, jsx(
|
|
314
|
+
}) : null, onIsWrappedChange ? jsx(DropdownParent, null, jsx(DropdownMenu, {
|
|
315
|
+
trigger: getTriggerButton,
|
|
316
|
+
onOpenChange: onDropdownOpenChange,
|
|
317
|
+
placement: 'bottom'
|
|
318
|
+
}, jsx(DropdownItem, {
|
|
319
|
+
elemBefore: isWrapped ? jsx(UnwrapTextIcon, null) : jsx(WrapTextIcon, null),
|
|
320
|
+
testId: `${id}-column-dropdown-item-toggle-wrapping`,
|
|
321
|
+
onClick: toggleWrap
|
|
322
|
+
}, isWrapped ? jsx(FormattedMessage, issueLikeTableMessages.unwrapText) : jsx(FormattedMessage, issueLikeTableMessages.wrapText)))) : children, jsx("div", {
|
|
274
323
|
ref: dropTargetRef,
|
|
275
324
|
css: [dropTargetStyles, isDraggingAnyColumn ? null : noPointerEventsStyles],
|
|
276
325
|
style: {
|
|
@@ -279,7 +328,5 @@ export const DraggableTableHeading = ({
|
|
|
279
328
|
"data-testid": 'column-drop-target'
|
|
280
329
|
}, closestEdge && jsx(DropIndicator, {
|
|
281
330
|
edge: closestEdge
|
|
282
|
-
})),
|
|
283
|
-
css: verticallyAlignedStyles
|
|
284
|
-
}, children), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
|
|
331
|
+
})), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
|
|
285
332
|
};
|
|
@@ -5,14 +5,12 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import styled from '@emotion/styled';
|
|
6
6
|
import { useIntl } from 'react-intl-next';
|
|
7
7
|
import invariant from 'tiny-invariant';
|
|
8
|
-
import Heading from '@atlaskit/heading';
|
|
9
8
|
import { Skeleton } from '@atlaskit/linking-common';
|
|
10
9
|
import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
11
10
|
import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
|
|
12
11
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
13
12
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
14
13
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
|
-
import { Flex } from '@atlaskit/primitives';
|
|
16
14
|
import { N40 } from '@atlaskit/theme/colors';
|
|
17
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
18
16
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
@@ -22,7 +20,7 @@ import { DragColumnPreview } from './drag-column-preview';
|
|
|
22
20
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
23
21
|
import TableEmptyState from './empty-state';
|
|
24
22
|
import { fallbackRenderType, stringifyType } from './render-type';
|
|
25
|
-
import { Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
|
|
23
|
+
import { fieldTextFontSize, Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
|
|
26
24
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
27
25
|
import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
|
|
28
26
|
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
@@ -37,58 +35,49 @@ const truncateTextStyles = css({
|
|
|
37
35
|
textOverflow: 'ellipsis',
|
|
38
36
|
whiteSpace: 'nowrap'
|
|
39
37
|
});
|
|
40
|
-
const ColumnPickerHeader = styled.th
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
border: 0
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
${"var(--ds-elevation-surface-current, #FFF)"} 10%
|
|
58
|
-
);
|
|
59
|
-
vertical-align: middle; /* Keeps dropdown button in the middle */
|
|
60
|
-
text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */
|
|
38
|
+
const ColumnPickerHeader = styled.th({
|
|
39
|
+
[`${withTablePluginHeaderPrefix()}`]: {
|
|
40
|
+
boxSizing: 'content-box',
|
|
41
|
+
border: 0,
|
|
42
|
+
width: '56px',
|
|
43
|
+
zIndex: 10,
|
|
44
|
+
position: 'sticky',
|
|
45
|
+
right: `calc(-1 * ${tableSidePadding})`,
|
|
46
|
+
backgroundColor: "var(--ds-elevation-surface-current, #FFF)",
|
|
47
|
+
borderBottom: `2px solid ${`var(--ds-border, ${N40})`}`,
|
|
48
|
+
paddingRight: "var(--ds-space-100, 4px)",
|
|
49
|
+
background: `linear-gradient( 90deg, rgba(255, 255, 255, 0) 0%, ${"var(--ds-elevation-surface-current, #FFF)"} 10% )`,
|
|
50
|
+
verticalAlign: 'middle',
|
|
51
|
+
textAlign: 'right'
|
|
52
|
+
},
|
|
53
|
+
[`${withTablePluginHeaderPrefix('&:last-of-type')}`]: {
|
|
54
|
+
paddingRight: tableSidePadding
|
|
61
55
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const TableCell = styled.td
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
padding:
|
|
71
|
-
border: 0
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
${withTablePluginBodyPrefix('&:last-child')} {
|
|
88
|
-
border-right: 0;
|
|
89
|
-
padding-right: ${"var(--ds-space-100, 8px)"};
|
|
56
|
+
});
|
|
57
|
+
const truncateStyles = css({
|
|
58
|
+
textOverflow: 'ellipsis',
|
|
59
|
+
whiteSpace: 'nowrap'
|
|
60
|
+
});
|
|
61
|
+
const TableCell = styled.td({
|
|
62
|
+
[`${withTablePluginBodyPrefix()}`]: {
|
|
63
|
+
fontSize: fieldTextFontSize,
|
|
64
|
+
padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"}`,
|
|
65
|
+
border: 0,
|
|
66
|
+
minWidth: 'auto',
|
|
67
|
+
verticalAlign: 'inherit',
|
|
68
|
+
boxSizing: 'border-box',
|
|
69
|
+
borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
|
|
70
|
+
borderBottom: `0.5px solid ${`var(--ds-border, ${N40})`}`,
|
|
71
|
+
overflow: 'hidden'
|
|
72
|
+
},
|
|
73
|
+
[`${withTablePluginBodyPrefix('&:first-child')}`]: {
|
|
74
|
+
paddingLeft: "var(--ds-space-100, 8px)"
|
|
75
|
+
},
|
|
76
|
+
[`${withTablePluginBodyPrefix('&:last-child')}`]: {
|
|
77
|
+
borderRight: 0,
|
|
78
|
+
paddingRight: "var(--ds-space-100, 8px)"
|
|
90
79
|
}
|
|
91
|
-
|
|
80
|
+
});
|
|
92
81
|
const tableContainerStyles = css({
|
|
93
82
|
borderRadius: 'inherit',
|
|
94
83
|
borderBottomLeftRadius: 0,
|
|
@@ -233,6 +222,19 @@ const tableStyles = css({
|
|
|
233
222
|
const noDefaultBorderStyles = css({
|
|
234
223
|
borderBottom: 0
|
|
235
224
|
});
|
|
225
|
+
const headerStyles = css({
|
|
226
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
227
|
+
fontWeight: "var(--ds-font-weight-medium, 500)"
|
|
228
|
+
});
|
|
229
|
+
const headingHoverEffectStyles = css({
|
|
230
|
+
display: 'flex',
|
|
231
|
+
alignItems: 'center',
|
|
232
|
+
whiteSpace: 'nowrap',
|
|
233
|
+
'&:hover': {
|
|
234
|
+
background: "var(--ds-background-input-hovered, #F7F8F9)",
|
|
235
|
+
borderRadius: "var(--ds-border-radius-200, 3px)"
|
|
236
|
+
}
|
|
237
|
+
});
|
|
236
238
|
function extractIndex(data) {
|
|
237
239
|
const {
|
|
238
240
|
index
|
|
@@ -293,6 +295,8 @@ export const IssueLikeDataTableView = ({
|
|
|
293
295
|
onVisibleColumnKeysChange,
|
|
294
296
|
columnCustomSizes,
|
|
295
297
|
onColumnResize,
|
|
298
|
+
wrappedColumnKeys,
|
|
299
|
+
onWrappedColumnChange,
|
|
296
300
|
status,
|
|
297
301
|
hasNextPage,
|
|
298
302
|
scrollableContainerHeight,
|
|
@@ -452,7 +456,7 @@ export const IssueLikeDataTableView = ({
|
|
|
452
456
|
type,
|
|
453
457
|
value
|
|
454
458
|
}, intl.formatMessage, intl.formatDate)).filter(value => value !== '').join(', ');
|
|
455
|
-
const contentComponent = stringifiedContent ? jsx(Tooltip, {
|
|
459
|
+
const contentComponent = stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(key)) ? jsx(Tooltip, {
|
|
456
460
|
tag: TruncateTextTag,
|
|
457
461
|
content: stringifiedContent,
|
|
458
462
|
testId: "issues-table-cell-tooltip"
|
|
@@ -464,7 +468,7 @@ export const IssueLikeDataTableView = ({
|
|
|
464
468
|
};
|
|
465
469
|
}),
|
|
466
470
|
ref: rowIndex === items.length - 1 ? el => setLastRowElement(el) : undefined
|
|
467
|
-
})), [items, visibleSortedColumns, getColumnWidth,
|
|
471
|
+
})), [items, visibleSortedColumns, renderItem, wrappedColumnKeys, getColumnWidth, intl.formatMessage, intl.formatDate]);
|
|
468
472
|
const rows = useMemo(() => {
|
|
469
473
|
if (status !== 'loading') {
|
|
470
474
|
return tableRows;
|
|
@@ -536,14 +540,20 @@ export const IssueLikeDataTableView = ({
|
|
|
536
540
|
content,
|
|
537
541
|
width
|
|
538
542
|
}, cellIndex) => {
|
|
539
|
-
|
|
543
|
+
let heading = jsx(Tooltip, {
|
|
540
544
|
content: content,
|
|
541
545
|
tag: "span",
|
|
546
|
+
position: "bottom-start",
|
|
542
547
|
testId: 'datasource-header-content'
|
|
543
|
-
}, jsx(
|
|
544
|
-
|
|
545
|
-
as: 'span'
|
|
548
|
+
}, jsx("span", {
|
|
549
|
+
css: headerStyles
|
|
546
550
|
}, content));
|
|
551
|
+
const isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
|
|
552
|
+
if (isHeadingOutsideButton) {
|
|
553
|
+
heading = jsx("div", {
|
|
554
|
+
css: headingHoverEffectStyles
|
|
555
|
+
}, heading);
|
|
556
|
+
}
|
|
547
557
|
if (isEditable) {
|
|
548
558
|
var _containerRef$current3;
|
|
549
559
|
const previewRows = tableRows.map(({
|
|
@@ -568,7 +578,9 @@ export const IssueLikeDataTableView = ({
|
|
|
568
578
|
width: width,
|
|
569
579
|
onWidthChange: onColumnResize === null || onColumnResize === void 0 ? void 0 : onColumnResize.bind(null, key),
|
|
570
580
|
dndPreviewHeight: ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetHeight) || 0,
|
|
571
|
-
dragPreview: dragPreview
|
|
581
|
+
dragPreview: dragPreview,
|
|
582
|
+
isWrapped: wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key),
|
|
583
|
+
onIsWrappedChange: onWrappedColumnChange === null || onWrappedColumnChange === void 0 ? void 0 : onWrappedColumnChange.bind(null, key)
|
|
572
584
|
}, heading);
|
|
573
585
|
} else {
|
|
574
586
|
return jsx(TableHeading, {
|
|
@@ -578,7 +590,7 @@ export const IssueLikeDataTableView = ({
|
|
|
578
590
|
shouldUseWidth,
|
|
579
591
|
width
|
|
580
592
|
})
|
|
581
|
-
},
|
|
593
|
+
}, heading);
|
|
582
594
|
}
|
|
583
595
|
}), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
|
|
584
596
|
columns: hasFullSchema ? orderedColumns : [],
|
|
@@ -618,7 +630,8 @@ export const IssueLikeDataTableView = ({
|
|
|
618
630
|
key: cellKey,
|
|
619
631
|
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
620
632
|
colSpan: isEditable && isLastCell ? 2 : undefined,
|
|
621
|
-
style: loadingRowStyle
|
|
633
|
+
style: loadingRowStyle,
|
|
634
|
+
css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
|
|
622
635
|
}, content);
|
|
623
636
|
}))))));
|
|
624
637
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const issueLikeTableMessages = defineMessages({
|
|
3
|
+
wrapText: {
|
|
4
|
+
id: 'linkDataSource.issue-line-table.wrap-text',
|
|
5
|
+
description: 'Table header Dropdown item for making whole column to wrap text',
|
|
6
|
+
defaultMessage: 'Wrap text'
|
|
7
|
+
},
|
|
8
|
+
unwrapText: {
|
|
9
|
+
id: 'linkDataSource.issue-line-table.unwrap-text',
|
|
10
|
+
description: 'Table header Dropdown item for making whole column to not wrap text',
|
|
11
|
+
defaultMessage: 'Unwrap text'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
|
-
import {
|
|
4
|
+
import { fieldTextFontSize } from '../../styled';
|
|
5
5
|
export const DATETIME_TYPE_TEST_ID = 'link-datasource-render-type--datetime';
|
|
6
6
|
const dateOptions = {
|
|
7
7
|
month: 'short',
|
|
@@ -13,9 +13,9 @@ const timeOptions = {
|
|
|
13
13
|
hour: '2-digit',
|
|
14
14
|
minute: '2-digit'
|
|
15
15
|
};
|
|
16
|
-
const DateTimeWrapper = styled.span
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const DateTimeWrapper = styled.span({
|
|
17
|
+
fontSize: fieldTextFontSize
|
|
18
|
+
});
|
|
19
19
|
export function getFormattedDate(value, display = 'datetime', formatDate) {
|
|
20
20
|
/* In some cases we get a value of `2023-12-20` which when parsed by JS assumes meantime timezone, causing the date
|
|
21
21
|
to be one day off in some timezones. We want it to display the date without converting timezones and a solution
|
|
@@ -4,7 +4,7 @@ import { HoverCard } from '@atlaskit/smart-card/hover-card';
|
|
|
4
4
|
import LinkUrl from '@atlaskit/smart-card/link-url';
|
|
5
5
|
import { N300 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { h300 } from '@atlaskit/theme/typography';
|
|
7
|
-
import {
|
|
7
|
+
import { fieldTextFontSize } from '../../styled';
|
|
8
8
|
const linkStyles = {
|
|
9
9
|
key: {
|
|
10
10
|
...h300(),
|
|
@@ -30,7 +30,7 @@ const LinkRenderType = ({
|
|
|
30
30
|
href: url,
|
|
31
31
|
style: {
|
|
32
32
|
...linkStyle,
|
|
33
|
-
fontSize:
|
|
33
|
+
fontSize: fieldTextFontSize
|
|
34
34
|
},
|
|
35
35
|
"data-testid": testId,
|
|
36
36
|
target: "_blank"
|
|
@@ -4,9 +4,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
|
|
5
5
|
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
const rootStyles = css({
|
|
7
|
-
whiteSpace: 'nowrap',
|
|
8
|
-
textOverflow: 'ellipsis',
|
|
9
|
-
overflow: 'hidden',
|
|
10
7
|
position: 'relative',
|
|
11
8
|
display: 'block'
|
|
12
9
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import {
|
|
3
|
+
import { fieldTextFontSize } from '../../styled';
|
|
4
4
|
export const TEXT_TYPE_TEST_ID = 'link-datasource-render-type--text';
|
|
5
|
-
const TextWrapper = styled.span
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const TextWrapper = styled.span({
|
|
6
|
+
fontSize: fieldTextFontSize
|
|
7
|
+
});
|
|
8
8
|
const TextRenderType = ({
|
|
9
9
|
text,
|
|
10
10
|
testId = TEXT_TYPE_TEST_ID
|
|
@@ -7,12 +7,12 @@ import Avatar from '@atlaskit/avatar';
|
|
|
7
7
|
import AvatarGroup from '@atlaskit/avatar-group';
|
|
8
8
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
9
9
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
10
|
-
import {
|
|
10
|
+
import { fieldTextFontSize } from '../../styled';
|
|
11
11
|
import { userTypeMessages } from './messages';
|
|
12
12
|
const userWrapperStyles = xcss({
|
|
13
13
|
display: 'flex',
|
|
14
14
|
alignItems: 'center',
|
|
15
|
-
fontSize: `${
|
|
15
|
+
fontSize: `${fieldTextFontSize}px`
|
|
16
16
|
});
|
|
17
17
|
const avatarWrapperStyles = xcss({
|
|
18
18
|
marginRight: '5px'
|
|
@@ -20,11 +20,11 @@ const avatarWrapperStyles = xcss({
|
|
|
20
20
|
const widthObserverWrapperStyles = xcss({
|
|
21
21
|
position: 'relative'
|
|
22
22
|
});
|
|
23
|
-
const AvatarGroupWrapperStyles = styled.div
|
|
24
|
-
ul {
|
|
25
|
-
|
|
23
|
+
const AvatarGroupWrapperStyles = styled.div({
|
|
24
|
+
ul: {
|
|
25
|
+
paddingLeft: '0px !important'
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
});
|
|
28
28
|
const getMaxUserCount = (userCount, availableWidth) => {
|
|
29
29
|
if (availableWidth <= 28) {
|
|
30
30
|
// If width is less than or equal to 28px, we should only display the user count
|