@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.
Files changed (57) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +5 -1
  3. package/dist/cjs/ui/issue-like-table/custom-icons.js +55 -0
  4. package/dist/cjs/ui/issue-like-table/drag-column-preview.js +20 -5
  5. package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +72 -13
  6. package/dist/cjs/ui/issue-like-table/index.js +70 -15
  7. package/dist/cjs/ui/issue-like-table/messages.js +19 -0
  8. package/dist/cjs/ui/issue-like-table/render-type/date-time/index.js +3 -3
  9. package/dist/cjs/ui/issue-like-table/render-type/link/index.js +1 -1
  10. package/dist/cjs/ui/issue-like-table/render-type/richtext/index.js +0 -3
  11. package/dist/cjs/ui/issue-like-table/render-type/text/index.js +3 -3
  12. package/dist/cjs/ui/issue-like-table/render-type/user/index.js +8 -5
  13. package/dist/cjs/ui/issue-like-table/styled.js +34 -6
  14. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +5 -1
  15. package/dist/es2019/ui/issue-like-table/custom-icons.js +42 -0
  16. package/dist/es2019/ui/issue-like-table/drag-column-preview.js +19 -18
  17. package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +58 -11
  18. package/dist/es2019/ui/issue-like-table/index.js +75 -62
  19. package/dist/es2019/ui/issue-like-table/messages.js +13 -0
  20. package/dist/es2019/ui/issue-like-table/render-type/date-time/index.js +4 -4
  21. package/dist/es2019/ui/issue-like-table/render-type/link/index.js +2 -2
  22. package/dist/es2019/ui/issue-like-table/render-type/richtext/index.js +0 -3
  23. package/dist/es2019/ui/issue-like-table/render-type/text/index.js +4 -4
  24. package/dist/es2019/ui/issue-like-table/render-type/user/index.js +6 -6
  25. package/dist/es2019/ui/issue-like-table/styled.js +36 -56
  26. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +5 -1
  27. package/dist/esm/ui/issue-like-table/custom-icons.js +48 -0
  28. package/dist/esm/ui/issue-like-table/drag-column-preview.js +19 -5
  29. package/dist/esm/ui/issue-like-table/draggable-table-heading.js +66 -11
  30. package/dist/esm/ui/issue-like-table/index.js +71 -16
  31. package/dist/esm/ui/issue-like-table/messages.js +13 -0
  32. package/dist/esm/ui/issue-like-table/render-type/date-time/index.js +4 -4
  33. package/dist/esm/ui/issue-like-table/render-type/link/index.js +2 -2
  34. package/dist/esm/ui/issue-like-table/render-type/richtext/index.js +0 -3
  35. package/dist/esm/ui/issue-like-table/render-type/text/index.js +4 -4
  36. package/dist/esm/ui/issue-like-table/render-type/user/index.js +7 -5
  37. package/dist/esm/ui/issue-like-table/styled.js +33 -5
  38. package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +6 -2
  39. package/dist/types/ui/datasource-table-view/types.d.ts +3 -14
  40. package/dist/types/ui/issue-like-table/custom-icons.d.ts +5 -0
  41. package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +7 -3
  42. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  43. package/dist/types/ui/issue-like-table/messages.d.ts +12 -0
  44. package/dist/types/ui/issue-like-table/styled.d.ts +1 -1
  45. package/dist/types/ui/issue-like-table/types.d.ts +18 -2
  46. package/dist/types-ts4.5/ui/datasource-table-view/datasourceTableView.d.ts +6 -2
  47. package/dist/types-ts4.5/ui/datasource-table-view/types.d.ts +3 -14
  48. package/dist/types-ts4.5/ui/issue-like-table/custom-icons.d.ts +5 -0
  49. package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +7 -3
  50. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  51. package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +12 -0
  52. package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +1 -1
  53. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +18 -2
  54. package/examples-helpers/buildIssueLikeTable.tsx +26 -24
  55. package/examples-helpers/buildJiraIssuesTable.tsx +17 -22
  56. package/examples-helpers/useCommonTableProps.tsx +57 -0
  57. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  import styled from '@emotion/styled';
2
2
  import { N40 } from '@atlaskit/theme/colors';
3
3
  export const ScrollableContainerHeight = 590;
4
- export const FieldTextFontSize = '14px';
5
- export const Table = styled.table`
6
- width: 100%;
7
- `;
4
+ export const fieldTextFontSize = "var(--ds-font-size-100, 14px)";
5
+ export const Table = styled.table({
6
+ width: '100%'
7
+ });
8
8
  const lineHeight = "var(--ds-font-lineHeight-300, 24px)";
9
9
  const verticalPadding = "var(--ds-space-025, 2px)";
10
10
 
@@ -21,56 +21,36 @@ export const withTablePluginPrefix = (tableSection, mainRule = '&') => `
21
21
  `;
22
22
  export const withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
23
23
  export const withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
24
- export const TableHeading = styled.th`
25
- ${withTablePluginHeaderPrefix()} {
26
- border: 0;
27
- position: relative;
28
-
29
- /* This makes resizing work with out jumping due to padding + changes overall width for same default values. */
30
- box-sizing: border-box;
31
-
32
- line-height: ${lineHeight};
33
- padding: ${verticalPadding} ${"var(--ds-space-050, 4px)"};
34
- border-right: 0.5px solid ${`var(--ds-border, ${N40})`};
35
- border-bottom: 2px solid ${`var(--ds-border, ${N40})`};
36
-
37
- /*
38
- lineHeight * 2 -> Max height of two lined header
39
- verticalPadding * 2 -> padding for this component itself
40
- verticalPadding * 2 -> padding inside span (--container)
41
- 2px -> Bottom border
42
- Last two terms are needed because of border-box box sizing.
43
- */
44
- height: calc(${lineHeight} * 2 + ${verticalPadding} * 4 + 2px);
45
- vertical-align: bottom;
46
- background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
47
- }
48
-
49
- ${withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)')} {
50
- border-right: 0;
51
- }
52
-
53
- ${withTablePluginHeaderPrefix('&:first-child')} {
54
- padding-left: ${"var(--ds-space-050, 4px)"};
55
- }
56
-
57
- ${withTablePluginHeaderPrefix('&:last-child')} {
58
- border-right: 0;
59
- }
60
-
61
- & [data-testid='datasource-header-content--container'] {
62
- width: 100%;
63
- padding: ${verticalPadding} ${"var(--ds-space-050, 4px)"};
64
- display: -webkit-box;
65
- -webkit-line-clamp: 2;
66
- -webkit-box-orient: vertical;
67
- white-space: normal;
68
- overflow: hidden;
69
- word-wrap: break-word;
70
-
71
- &:hover {
72
- background: ${"var(--ds-background-input-hovered, #F7F8F9)"};
73
- border-radius: 3px;
74
- }
24
+ export const TableHeading = styled.th({
25
+ [`${withTablePluginHeaderPrefix()}`]: {
26
+ border: 0,
27
+ position: 'relative',
28
+ boxSizing: 'border-box',
29
+ lineHeight: lineHeight,
30
+ padding: `${verticalPadding} ${"var(--ds-space-050, 4px)"}`,
31
+ borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
32
+ borderBottom: `2px solid ${`var(--ds-border, ${N40})`}`,
33
+ height: `calc(${lineHeight} * 2 + ${verticalPadding} * 4 + 2px)`,
34
+ verticalAlign: 'bottom',
35
+ backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
36
+ },
37
+ [`${withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)')}`]: {
38
+ borderRight: 0
39
+ },
40
+ [`${withTablePluginHeaderPrefix('&:first-child')}`]: {
41
+ paddingLeft: "var(--ds-space-050, 4px)"
42
+ },
43
+ [`${withTablePluginHeaderPrefix('&:last-child')}`]: {
44
+ borderRight: 0
45
+ },
46
+ "& [data-testid='datasource-header-content--container']": {
47
+ width: '100%',
48
+ padding: `${verticalPadding} ${"var(--ds-space-050, 4px)"}`,
49
+ display: '-webkit-box',
50
+ WebkitLineClamp: 2,
51
+ WebkitBoxOrient: 'vertical',
52
+ whiteSpace: 'normal',
53
+ overflow: 'hidden',
54
+ wordWrap: 'break-word'
75
55
  }
76
- `;
56
+ });
@@ -30,7 +30,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
30
30
  onVisibleColumnKeysChange = _ref.onVisibleColumnKeysChange,
31
31
  url = _ref.url,
32
32
  columnCustomSizes = _ref.columnCustomSizes,
33
- onColumnResize = _ref.onColumnResize;
33
+ onColumnResize = _ref.onColumnResize,
34
+ wrappedColumnKeys = _ref.wrappedColumnKeys,
35
+ onWrappedColumnChange = _ref.onWrappedColumnChange;
34
36
  var _useDatasourceTableSt = useDatasourceTableState({
35
37
  datasourceId: datasourceId,
36
38
  parameters: parameters,
@@ -158,6 +160,8 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
158
160
  onVisibleColumnKeysChange: onVisibleColumnKeysChange,
159
161
  columnCustomSizes: columnCustomSizes,
160
162
  onColumnResize: onColumnResize,
163
+ wrappedColumnKeys: wrappedColumnKeys,
164
+ onWrappedColumnChange: onWrappedColumnChange,
161
165
  scrollableContainerHeight: ScrollableContainerHeight,
162
166
  parentContainerRenderInstanceId: tableRenderInstanceId,
163
167
  extensionKey: extensionKey
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ export var GlyphPlaceholder = function GlyphPlaceholder(props) {
3
+ return /*#__PURE__*/React.createElement("svg", {
4
+ width: "24",
5
+ height: "24",
6
+ viewBox: "0 0 24 24",
7
+ "data-testid": props['data-testid'],
8
+ "aria-label": props['aria-label'],
9
+ className: props.className
10
+ });
11
+ };
12
+ export var WrapTextIcon = function WrapTextIcon() {
13
+ return /*#__PURE__*/React.createElement("svg", {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ width: "24",
16
+ height: "24",
17
+ viewBox: "0 0 24 24",
18
+ fill: "none"
19
+ }, /*#__PURE__*/React.createElement("path", {
20
+ fillRule: "evenodd",
21
+ clipRule: "evenodd",
22
+ 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",
23
+ fill: 'currentColor'
24
+ }));
25
+ };
26
+ export var UnwrapTextIcon = function UnwrapTextIcon() {
27
+ return /*#__PURE__*/React.createElement("svg", {
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ width: "24",
30
+ height: "24",
31
+ viewBox: "0 0 24 24",
32
+ fill: "none"
33
+ }, /*#__PURE__*/React.createElement("path", {
34
+ fillRule: "evenodd",
35
+ clipRule: "evenodd",
36
+ 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",
37
+ fill: "currentColor"
38
+ }), /*#__PURE__*/React.createElement("path", {
39
+ 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",
40
+ fill: "currentColor"
41
+ }), /*#__PURE__*/React.createElement("path", {
42
+ d: "M10.1714 11L6 11C5.44772 11 5 11.4477 5 12C5 12.5523 5.44772 13 6 13H8.17139L10.1714 11Z",
43
+ fill: "currentColor"
44
+ }), /*#__PURE__*/React.createElement("path", {
45
+ 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",
46
+ fill: "currentColor"
47
+ }));
48
+ };
@@ -1,19 +1,33 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2;
3
1
  /** @jsx jsx */
4
2
  import React from 'react';
5
3
  import { css, jsx } from '@emotion/react';
6
4
  import styled from '@emotion/styled';
5
+ import { N40 } from '@atlaskit/theme/colors';
7
6
  import { TableHeading } from './styled';
8
7
  var maxWidth = '200px';
9
8
  var firstLastChildOverride = "\n &:first-of-type, &:last-of-type {\n padding-left: ".concat("var(--ds-space-100, 8px)", ";\n padding-right: ", "var(--ds-space-100, 8px)", ";\n }\n");
10
- var TablePreviewHeading = styled(TableHeading)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n background: ", ";\n color: ", ";\n max-width: ", ";\n ", "\n"])), "var(--ds-background-disabled, #091E4224)", "var(--ds-text-disabled, #091E424F)", maxWidth, firstLastChildOverride);
11
- var TablePreviewCell = styled.td(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: ", ";\n padding: ", " ", ";\n ", "\n"])), maxWidth, "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", firstLastChildOverride);
9
+ var TablePreviewHeading = styled(TableHeading)({
10
+ overflow: 'hidden',
11
+ textOverflow: 'ellipsis',
12
+ whiteSpace: 'nowrap',
13
+ background: "var(--ds-background-disabled, #091E4224)",
14
+ maxWidth: maxWidth
15
+ }, firstLastChildOverride);
16
+ var TablePreviewCell = styled.td({
17
+ overflow: 'hidden',
18
+ textOverflow: 'ellipsis',
19
+ whiteSpace: 'nowrap',
20
+ maxWidth: maxWidth,
21
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
22
+ boxSizing: 'border-box',
23
+ borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
24
+ height: '30px'
25
+ }, firstLastChildOverride);
12
26
  var tableStyles = css({
13
27
  background: "var(--ds-surface, #FFF)",
14
28
  borderCollapse: 'separate',
15
29
  borderSpacing: 0,
16
- fontSize: "var(--ds-font-size-200, 16px)",
30
+ fontSize: "var(--ds-font-size-100, 14px)",
17
31
  maxWidth: maxWidth
18
32
  });
19
33
  export var DragColumnPreview = function DragColumnPreview(_ref) {
@@ -1,12 +1,23 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
6
+ var _excluded = ["triggerRef"];
7
+ var _templateObject;
3
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
10
  /** @jsx jsx */
6
- import { useEffect, useRef, useState } from 'react';
11
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
12
  import { css, jsx } from '@emotion/react';
13
+ import styled from '@emotion/styled';
8
14
  import ReactDOM from 'react-dom';
15
+ import { FormattedMessage } from 'react-intl-next';
9
16
  import invariant from 'tiny-invariant';
17
+ import Button from '@atlaskit/button/new';
18
+ import DropdownMenu, { DropdownItem } from '@atlaskit/dropdown-menu';
19
+ import ChevronDown from '@atlaskit/icon/glyph/chevron-down';
20
+ import ChevronUp from '@atlaskit/icon/glyph/chevron-up';
10
21
  import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
11
22
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box-without-terminal';
12
23
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
@@ -15,13 +26,11 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/elem
15
26
  import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
16
27
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
17
28
  import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
29
+ import { GlyphPlaceholder, UnwrapTextIcon, WrapTextIcon } from './custom-icons';
30
+ import { issueLikeTableMessages } from './messages';
18
31
  import { TableHeading } from './styled';
19
32
  import { COLUMN_MIN_WIDTH, getWidthCss } from './utils';
20
- var verticallyAlignedStyles = css({
21
- display: 'flex',
22
- alignItems: 'center',
23
- whiteSpace: 'nowrap'
24
- });
33
+ var DropdownParent = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n white-space: nowrap;\n & button {\n text-align: left; /* By default button center in the middle without props to control it */\n height: auto; /* By default button is not happy with tall (up to lines in our case) content */\n 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. */\n padding-right: 0px;\n }\n"])));
25
34
  var dropTargetStyles = css({
26
35
  position: 'absolute',
27
36
  top: 0,
@@ -79,7 +88,9 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
79
88
  dndPreviewHeight = _ref.dndPreviewHeight,
80
89
  dragPreview = _ref.dragPreview,
81
90
  width = _ref.width,
82
- onWidthChange = _ref.onWidthChange;
91
+ onWidthChange = _ref.onWidthChange,
92
+ isWrapped = _ref.isWrapped,
93
+ onIsWrappedChange = _ref.onIsWrappedChange;
83
94
  var mainHeaderCellRef = useRef(null);
84
95
  var columnResizeHandleRef = useRef(null);
85
96
  var _useState = useState(idleState),
@@ -259,6 +270,44 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
259
270
  }
260
271
  });
261
272
  }, [id, index, onWidthChange, state, tableId, width]);
273
+ var _useState7 = useState(false),
274
+ _useState8 = _slicedToArray(_useState7, 2),
275
+ buttonHovered = _useState8[0],
276
+ setButtonHovered = _useState8[1];
277
+ var _useState9 = useState(false),
278
+ _useState10 = _slicedToArray(_useState9, 2),
279
+ isDropdownOpen = _useState10[0],
280
+ setIsDropdownOpen = _useState10[1];
281
+ var isWideEnoughToHaveChevron = width > 76;
282
+ var shouldShowTriggerIcon = (buttonHovered || isDropdownOpen) && isWideEnoughToHaveChevron;
283
+ var triggerIcon = useMemo(function () {
284
+ return shouldShowTriggerIcon ? isDropdownOpen ? ChevronUp : ChevronDown : isWideEnoughToHaveChevron ? GlyphPlaceholder : undefined;
285
+ }, [shouldShowTriggerIcon, isDropdownOpen, isWideEnoughToHaveChevron]);
286
+ var getTriggerButton = useCallback(function (_ref8) {
287
+ var triggerRef = _ref8.triggerRef,
288
+ props = _objectWithoutProperties(_ref8, _excluded);
289
+ return jsx(Button, _extends({}, props, {
290
+ testId: "".concat(id, "-column-dropdown"),
291
+ shouldFitContainer: true,
292
+ iconAfter: triggerIcon,
293
+ ref: triggerRef,
294
+ appearance: "subtle",
295
+ spacing: "compact",
296
+ onMouseEnter: function onMouseEnter() {
297
+ return setButtonHovered(true);
298
+ },
299
+ onMouseLeave: function onMouseLeave() {
300
+ return setButtonHovered(false);
301
+ }
302
+ }), children);
303
+ }, [children, id, triggerIcon]);
304
+ var onDropdownOpenChange = useCallback(function (_ref9) {
305
+ var isOpen = _ref9.isOpen;
306
+ return setIsDropdownOpen(isOpen);
307
+ }, []);
308
+ var toggleWrap = useCallback(function () {
309
+ return onIsWrappedChange && onIsWrappedChange(!(isWrapped || false));
310
+ }, [isWrapped, onIsWrappedChange]);
262
311
  return jsx(TableHeading, {
263
312
  ref: mainHeaderCellRef,
264
313
  "data-testid": "".concat(id, "-column-heading"),
@@ -275,7 +324,15 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
275
324
  height: "".concat(dndPreviewHeight, "px")
276
325
  },
277
326
  "data-testid": "column-resize-handle"
278
- }) : null, jsx("div", {
327
+ }) : null, onIsWrappedChange ? jsx(DropdownParent, null, jsx(DropdownMenu, {
328
+ trigger: getTriggerButton,
329
+ onOpenChange: onDropdownOpenChange,
330
+ placement: 'bottom'
331
+ }, jsx(DropdownItem, {
332
+ elemBefore: isWrapped ? jsx(UnwrapTextIcon, null) : jsx(WrapTextIcon, null),
333
+ testId: "".concat(id, "-column-dropdown-item-toggle-wrapping"),
334
+ onClick: toggleWrap
335
+ }, isWrapped ? jsx(FormattedMessage, issueLikeTableMessages.unwrapText) : jsx(FormattedMessage, issueLikeTableMessages.wrapText)))) : children, jsx("div", {
279
336
  ref: dropTargetRef,
280
337
  css: [dropTargetStyles, isDraggingAnyColumn ? null : noPointerEventsStyles],
281
338
  style: {
@@ -284,7 +341,5 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
284
341
  "data-testid": 'column-drop-target'
285
342
  }, closestEdge && jsx(DropIndicator, {
286
343
  edge: closestEdge
287
- })), jsx("div", {
288
- css: verticallyAlignedStyles
289
- }, children), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
344
+ })), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
290
345
  };
@@ -1,10 +1,9 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
3
  import _extends from "@babel/runtime/helpers/extends";
5
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
6
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
7
- var _templateObject, _templateObject2;
5
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
+ var _styled$th, _styled$td;
8
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -14,14 +13,12 @@ import { css, jsx } from '@emotion/react';
14
13
  import styled from '@emotion/styled';
15
14
  import { useIntl } from 'react-intl-next';
16
15
  import invariant from 'tiny-invariant';
17
- import Heading from '@atlaskit/heading';
18
16
  import { Skeleton } from '@atlaskit/linking-common';
19
17
  import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
20
18
  import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
21
19
  import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
22
20
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
23
21
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
24
- import { Flex } from '@atlaskit/primitives';
25
22
  import { N40 } from '@atlaskit/theme/colors';
26
23
  import Tooltip from '@atlaskit/tooltip';
27
24
  import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
@@ -31,7 +28,7 @@ import { DragColumnPreview } from './drag-column-preview';
31
28
  import { DraggableTableHeading } from './draggable-table-heading';
32
29
  import TableEmptyState from './empty-state';
33
30
  import { fallbackRenderType, stringifyType } from './render-type';
34
- import { Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
31
+ import { fieldTextFontSize, Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
35
32
  import { useIsOnScreen } from './useIsOnScreen';
36
33
  import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
37
34
  var tableSidePadding = "var(--ds-space-200, 16px)";
@@ -46,8 +43,42 @@ var truncateTextStyles = css({
46
43
  textOverflow: 'ellipsis',
47
44
  whiteSpace: 'nowrap'
48
45
  });
49
- var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " {\n box-sizing: content-box;\n border: 0;\n\n width: 56px;\n z-index: 10;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business below */\n\n padding-right: ", ";\n\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */\n }\n\n ", " {\n padding-right: ", ";\n }\n"])), withTablePluginHeaderPrefix(), tableSidePadding, "var(--ds-elevation-surface-current, #FFF)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-space-100, 4px)", "var(--ds-elevation-surface-current, #FFF)", withTablePluginHeaderPrefix('&:last-of-type'), tableSidePadding);
50
- var TableCell = styled.td(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n /* First section here is to override things editor table plugin css defines */\n padding: ", " ", ";\n border: 0;\n min-width: auto;\n vertical-align: inherit;\n box-sizing: border-box;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-right: 0.5px solid ", ";\n border-bottom: 0.5px solid ", ";\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n padding-right: ", ";\n }\n"])), withTablePluginBodyPrefix(), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-border, ".concat(N40, ")"), withTablePluginBodyPrefix('&:first-child'), "var(--ds-space-100, 8px)", withTablePluginBodyPrefix('&:last-child'), "var(--ds-space-100, 8px)");
46
+ var ColumnPickerHeader = styled.th((_styled$th = {}, _defineProperty(_styled$th, "".concat(withTablePluginHeaderPrefix()), {
47
+ boxSizing: 'content-box',
48
+ border: 0,
49
+ width: '56px',
50
+ zIndex: 10,
51
+ position: 'sticky',
52
+ right: "calc(-1 * ".concat(tableSidePadding, ")"),
53
+ backgroundColor: "var(--ds-elevation-surface-current, #FFF)",
54
+ borderBottom: "2px solid ".concat("var(--ds-border, ".concat(N40, ")")),
55
+ paddingRight: "var(--ds-space-100, 4px)",
56
+ background: "linear-gradient( 90deg, rgba(255, 255, 255, 0) 0%, ".concat("var(--ds-elevation-surface-current, #FFF)", " 10% )"),
57
+ verticalAlign: 'middle',
58
+ textAlign: 'right'
59
+ }), _defineProperty(_styled$th, "".concat(withTablePluginHeaderPrefix('&:last-of-type')), {
60
+ paddingRight: tableSidePadding
61
+ }), _styled$th));
62
+ var truncateStyles = css({
63
+ textOverflow: 'ellipsis',
64
+ whiteSpace: 'nowrap'
65
+ });
66
+ var TableCell = styled.td((_styled$td = {}, _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix()), {
67
+ fontSize: fieldTextFontSize,
68
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
69
+ border: 0,
70
+ minWidth: 'auto',
71
+ verticalAlign: 'inherit',
72
+ boxSizing: 'border-box',
73
+ borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
74
+ borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
75
+ overflow: 'hidden'
76
+ }), _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix('&:first-child')), {
77
+ paddingLeft: "var(--ds-space-100, 8px)"
78
+ }), _defineProperty(_styled$td, "".concat(withTablePluginBodyPrefix('&:last-child')), {
79
+ borderRight: 0,
80
+ paddingRight: "var(--ds-space-100, 8px)"
81
+ }), _styled$td));
51
82
  var tableContainerStyles = css({
52
83
  borderRadius: 'inherit',
53
84
  borderBottomLeftRadius: 0,
@@ -156,6 +187,19 @@ var tableStyles = css({
156
187
  var noDefaultBorderStyles = css({
157
188
  borderBottom: 0
158
189
  });
190
+ var headerStyles = css({
191
+ fontSize: "var(--ds-font-size-075, 12px)",
192
+ fontWeight: "var(--ds-font-weight-medium, 500)"
193
+ });
194
+ var headingHoverEffectStyles = css({
195
+ display: 'flex',
196
+ alignItems: 'center',
197
+ whiteSpace: 'nowrap',
198
+ '&:hover': {
199
+ background: "var(--ds-background-input-hovered, #F7F8F9)",
200
+ borderRadius: "var(--ds-border-radius-200, 3px)"
201
+ }
202
+ });
159
203
  function extractIndex(data) {
160
204
  var index = data.index;
161
205
  invariant(typeof index === 'number');
@@ -219,6 +263,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
219
263
  onVisibleColumnKeysChange = _ref5.onVisibleColumnKeysChange,
220
264
  columnCustomSizes = _ref5.columnCustomSizes,
221
265
  onColumnResize = _ref5.onColumnResize,
266
+ wrappedColumnKeys = _ref5.wrappedColumnKeys,
267
+ onWrappedColumnChange = _ref5.onWrappedColumnChange,
222
268
  status = _ref5.status,
223
269
  hasNextPage = _ref5.hasNextPage,
224
270
  scrollableContainerHeight = _ref5.scrollableContainerHeight,
@@ -405,7 +451,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
405
451
  }).filter(function (value) {
406
452
  return value !== '';
407
453
  }).join(', ');
408
- var contentComponent = stringifiedContent ? jsx(Tooltip, {
454
+ var contentComponent = stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(key)) ? jsx(Tooltip, {
409
455
  tag: TruncateTextTag,
410
456
  content: stringifiedContent,
411
457
  testId: "issues-table-cell-tooltip"
@@ -421,7 +467,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
421
467
  } : undefined
422
468
  };
423
469
  });
424
- }, [items, visibleSortedColumns, getColumnWidth, renderItem, intl]);
470
+ }, [items, visibleSortedColumns, renderItem, wrappedColumnKeys, getColumnWidth, intl.formatMessage, intl.formatDate]);
425
471
  var rows = useMemo(function () {
426
472
  if (status !== 'loading') {
427
473
  return tableRows;
@@ -511,11 +557,17 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
511
557
  var heading = jsx(Tooltip, {
512
558
  content: content,
513
559
  tag: "span",
560
+ position: "bottom-start",
514
561
  testId: 'datasource-header-content'
515
- }, jsx(Heading, {
516
- level: "h200",
517
- as: 'span'
562
+ }, jsx("span", {
563
+ css: headerStyles
518
564
  }, content));
565
+ var isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
566
+ if (isHeadingOutsideButton) {
567
+ heading = jsx("div", {
568
+ css: headingHoverEffectStyles
569
+ }, heading);
570
+ }
519
571
  if (isEditable) {
520
572
  var _containerRef$current3;
521
573
  var previewRows = tableRows.map(function (_ref14) {
@@ -540,7 +592,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
540
592
  width: width,
541
593
  onWidthChange: onColumnResize === null || onColumnResize === void 0 ? void 0 : onColumnResize.bind(null, key),
542
594
  dndPreviewHeight: ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetHeight) || 0,
543
- dragPreview: dragPreview
595
+ dragPreview: dragPreview,
596
+ isWrapped: wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key),
597
+ onIsWrappedChange: onWrappedColumnChange === null || onWrappedColumnChange === void 0 ? void 0 : onWrappedColumnChange.bind(null, key)
544
598
  }, heading);
545
599
  } else {
546
600
  return jsx(TableHeading, {
@@ -550,7 +604,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
550
604
  shouldUseWidth: shouldUseWidth,
551
605
  width: width
552
606
  })
553
- }, jsx(Flex, null, heading));
607
+ }, heading);
554
608
  }
555
609
  }), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
556
610
  columns: hasFullSchema ? orderedColumns : [],
@@ -588,7 +642,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
588
642
  key: cellKey,
589
643
  "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
590
644
  colSpan: isEditable && isLastCell ? 2 : undefined,
591
- style: loadingRowStyle
645
+ style: loadingRowStyle,
646
+ css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
592
647
  }, content);
593
648
  }));
594
649
  }))));
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var 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,12 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
- var _templateObject;
4
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
4
  import React from 'react';
7
5
  import styled from '@emotion/styled';
8
6
  import { useIntl } from 'react-intl-next';
9
- import { FieldTextFontSize } from '../../styled';
7
+ import { fieldTextFontSize } from '../../styled';
10
8
  export var DATETIME_TYPE_TEST_ID = 'link-datasource-render-type--datetime';
11
9
  var dateOptions = {
12
10
  month: 'short',
@@ -18,7 +16,9 @@ var timeOptions = {
18
16
  hour: '2-digit',
19
17
  minute: '2-digit'
20
18
  };
21
- var DateTimeWrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: ", ";\n"])), FieldTextFontSize);
19
+ var DateTimeWrapper = styled.span({
20
+ fontSize: fieldTextFontSize
21
+ });
22
22
  export function getFormattedDate(value) {
23
23
  var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datetime';
24
24
  var formatDate = arguments.length > 2 ? arguments[2] : undefined;
@@ -7,7 +7,7 @@ import { HoverCard } from '@atlaskit/smart-card/hover-card';
7
7
  import LinkUrl from '@atlaskit/smart-card/link-url';
8
8
  import { N300 } from '@atlaskit/theme/colors';
9
9
  import { h300 } from '@atlaskit/theme/typography';
10
- import { FieldTextFontSize } from '../../styled';
10
+ import { fieldTextFontSize } from '../../styled';
11
11
  var linkStyles = {
12
12
  key: _objectSpread(_objectSpread({}, h300()), {}, {
13
13
  color: "var(--ds-text-subtlest, ".concat(N300, ")"),
@@ -32,7 +32,7 @@ var LinkRenderType = function LinkRenderType(_ref) {
32
32
  }, /*#__PURE__*/React.createElement(LinkUrl, {
33
33
  href: url,
34
34
  style: _objectSpread(_objectSpread({}, linkStyle), {}, {
35
- fontSize: FieldTextFontSize
35
+ fontSize: fieldTextFontSize
36
36
  }),
37
37
  "data-testid": testId,
38
38
  target: "_blank"
@@ -8,9 +8,6 @@ import { css, jsx } from '@emotion/react';
8
8
  import { defaultSchema } from '@atlaskit/adf-schema/schema-default';
9
9
  import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
10
10
  var rootStyles = css({
11
- whiteSpace: 'nowrap',
12
- textOverflow: 'ellipsis',
13
- overflow: 'hidden',
14
11
  position: 'relative',
15
12
  display: 'block'
16
13
  });
@@ -1,10 +1,10 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
1
  import React from 'react';
4
2
  import styled from '@emotion/styled';
5
- import { FieldTextFontSize } from '../../styled';
3
+ import { fieldTextFontSize } from '../../styled';
6
4
  export var TEXT_TYPE_TEST_ID = 'link-datasource-render-type--text';
7
- var TextWrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: ", ";\n"])), FieldTextFontSize);
5
+ var TextWrapper = styled.span({
6
+ fontSize: fieldTextFontSize
7
+ });
8
8
  var TextRenderType = function TextRenderType(_ref) {
9
9
  var text = _ref.text,
10
10
  _ref$testId = _ref.testId,
@@ -1,6 +1,4 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
- var _templateObject;
4
2
  /** @jsx jsx */
5
3
  import React, { useState } from 'react';
6
4
  import { jsx } from '@emotion/react';
@@ -10,12 +8,12 @@ import Avatar from '@atlaskit/avatar';
10
8
  import AvatarGroup from '@atlaskit/avatar-group';
11
9
  import { Box, xcss } from '@atlaskit/primitives';
12
10
  import { WidthObserver } from '@atlaskit/width-detector';
13
- import { FieldTextFontSize } from '../../styled';
11
+ import { fieldTextFontSize } from '../../styled';
14
12
  import { userTypeMessages } from './messages';
15
13
  var userWrapperStyles = xcss({
16
14
  display: 'flex',
17
15
  alignItems: 'center',
18
- fontSize: "".concat(FieldTextFontSize, "px")
16
+ fontSize: "".concat(fieldTextFontSize, "px")
19
17
  });
20
18
  var avatarWrapperStyles = xcss({
21
19
  marginRight: '5px'
@@ -23,7 +21,11 @@ var avatarWrapperStyles = xcss({
23
21
  var widthObserverWrapperStyles = xcss({
24
22
  position: 'relative'
25
23
  });
26
- var AvatarGroupWrapperStyles = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ul {\n padding-left: 0px !important;\n }\n"])));
24
+ var AvatarGroupWrapperStyles = styled.div({
25
+ ul: {
26
+ paddingLeft: '0px !important'
27
+ }
28
+ });
27
29
  var getMaxUserCount = function getMaxUserCount(userCount, availableWidth) {
28
30
  if (availableWidth <= 28) {
29
31
  // If width is less than or equal to 28px, we should only display the user count