@atlaskit/link-datasource 0.31.1 → 0.31.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/ui/assets-modal/modal/index.js +3 -3
  3. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -19
  4. package/dist/cjs/ui/issue-like-table/column-picker/index.js +2 -4
  5. package/dist/cjs/ui/issue-like-table/drag-column-preview.js +37 -0
  6. package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +60 -25
  7. package/dist/cjs/ui/issue-like-table/empty-state/index.js +6 -1
  8. package/dist/cjs/ui/issue-like-table/index.js +102 -71
  9. package/dist/cjs/ui/issue-like-table/styled.js +2 -1
  10. package/dist/cjs/ui/jira-issues-modal/modal/index.js +12 -9
  11. package/dist/cjs/ui/table-footer/index.js +10 -7
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/ui/assets-modal/modal/index.js +4 -4
  14. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -20
  15. package/dist/es2019/ui/issue-like-table/column-picker/index.js +1 -3
  16. package/dist/es2019/ui/issue-like-table/drag-column-preview.js +46 -0
  17. package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +53 -18
  18. package/dist/es2019/ui/issue-like-table/empty-state/index.js +6 -1
  19. package/dist/es2019/ui/issue-like-table/index.js +86 -43
  20. package/dist/es2019/ui/issue-like-table/styled.js +18 -0
  21. package/dist/es2019/ui/jira-issues-modal/modal/index.js +13 -10
  22. package/dist/es2019/ui/table-footer/index.js +11 -11
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/ui/assets-modal/modal/index.js +3 -3
  25. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +8 -20
  26. package/dist/esm/ui/issue-like-table/column-picker/index.js +2 -4
  27. package/dist/esm/ui/issue-like-table/drag-column-preview.js +29 -0
  28. package/dist/esm/ui/issue-like-table/draggable-table-heading.js +60 -25
  29. package/dist/esm/ui/issue-like-table/empty-state/index.js +6 -1
  30. package/dist/esm/ui/issue-like-table/index.js +102 -71
  31. package/dist/esm/ui/issue-like-table/styled.js +2 -1
  32. package/dist/esm/ui/jira-issues-modal/modal/index.js +13 -10
  33. package/dist/esm/ui/table-footer/index.js +10 -7
  34. package/dist/esm/version.json +1 -1
  35. package/dist/types/ui/issue-like-table/column-picker/index.d.ts +1 -1
  36. package/dist/types/ui/issue-like-table/column-picker/types.d.ts +0 -1
  37. package/dist/types/ui/issue-like-table/drag-column-preview.d.ts +7 -0
  38. package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
  39. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  40. package/dist/types/ui/issue-like-table/types.d.ts +5 -0
  41. package/dist/types-ts4.5/ui/issue-like-table/column-picker/index.d.ts +1 -1
  42. package/dist/types-ts4.5/ui/issue-like-table/column-picker/types.d.ts +0 -1
  43. package/dist/types-ts4.5/ui/issue-like-table/drag-column-preview.d.ts +7 -0
  44. package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
  45. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  46. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
  47. package/package.json +3 -3
@@ -7,10 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.TableHeading = exports.Table = exports.EmptyStateTableHeading = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _styled = _interopRequireDefault(require("@emotion/styled"));
10
+ var _colors = require("@atlaskit/theme/colors");
10
11
  var _templateObject, _templateObject2, _templateObject3;
11
12
  var Table = _styled.default.table(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n"])));
12
13
  exports.Table = Table;
13
- var TableHeading = _styled.default.th(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n padding-block: ", ";\n line-height: ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 24px)");
14
+ var TableHeading = _styled.default.th(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n cursor: grab;\n position: relative;\n padding-block: ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n .ProseMirror & h5,\n & h5 {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 24px; /* Is needed to keep overall height consistent with or without drag handle icon present */\n }\n\n &:hover .issue-like-table-drag-handle {\n width: 24px;\n }\n &:hover .issue-like-table-drag-handle-spacer {\n width: 0px;\n }\n"])), "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 24px)", "var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"));
14
15
  exports.TableHeading = TableHeading;
15
16
  var EmptyStateTableHeading = (0, _styled.default)(TableHeading)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n &:first-child {\n padding-left: ", ";\n }\n"])), "var(--ds-space-100, 8px)");
16
17
  exports.EmptyStateTableHeading = EmptyStateTableHeading;
@@ -37,8 +37,9 @@ var dropdownContainerStyles = (0, _react2.css)({
37
37
  });
38
38
  var contentContainerStyles = (0, _react2.css)({
39
39
  display: 'grid',
40
- height: '420px',
41
- overflow: 'auto'
40
+ maxHeight: '420px',
41
+ overflow: 'auto',
42
+ borderBottom: "2px solid ".concat("var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"))
42
43
  });
43
44
  var placeholderSmartLinkStyles = (0, _react2.css)({
44
45
  backgroundColor: "var(--ds-surface-raised, ".concat(_colors.N0, ")"),
@@ -211,7 +212,9 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
211
212
  setCurrentViewMode(selectedMode);
212
213
  };
213
214
  var issueLikeDataTableView = (0, _react.useMemo)(function () {
214
- return (0, _react2.jsx)(_issueLikeTable.IssueLikeDataTableView, {
215
+ return (0, _react2.jsx)("div", {
216
+ css: contentContainerStyles
217
+ }, (0, _react2.jsx)(_issueLikeTable.IssueLikeDataTableView, {
215
218
  testId: "jira-jql-datasource-table",
216
219
  status: status,
217
220
  columns: columns,
@@ -221,7 +224,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
221
224
  onNextPage: onNextPage,
222
225
  onLoadDatasourceDetails: loadDatasourceDetails,
223
226
  onVisibleColumnKeysChange: setVisibleColumnKeys
224
- });
227
+ }));
225
228
  }, [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
226
229
  var renderCountModeContent = (0, _react.useCallback)(function () {
227
230
  var url = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
@@ -258,9 +261,11 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
258
261
  return (0, _react2.jsx)(_noResults.NoResults, null);
259
262
  } else if (status === 'empty' || !columns.length) {
260
263
  // persist the empty state when making the initial /data request which contains the columns
261
- return (0, _react2.jsx)(_issueLikeTable.EmptyState, {
264
+ return (0, _react2.jsx)("div", {
265
+ css: contentContainerStyles
266
+ }, (0, _react2.jsx)(_issueLikeTable.EmptyState, {
262
267
  testId: "jira-jql-datasource-modal--empty-state"
263
- });
268
+ }));
264
269
  }
265
270
  var firstIssueUrl = retrieveUrlForSmartCardRender();
266
271
  if (responseItems.length === 1 && firstIssueUrl) {
@@ -303,9 +308,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
303
308
  isSearching: status === 'loading',
304
309
  parameters: parameters,
305
310
  onSearch: onSearch
306
- }), (0, _react2.jsx)("div", {
307
- css: contentContainerStyles
308
- }, currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent())), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowIssueCount && (0, _react2.jsx)("div", {
311
+ }), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowIssueCount && (0, _react2.jsx)("div", {
309
312
  "data-testid": "jira-jql-datasource-modal-total-issues-count",
310
313
  css: issueCountStyles
311
314
  }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
@@ -18,12 +18,13 @@ var _refresh = _interopRequireDefault(require("@atlaskit/icon/glyph/refresh"));
18
18
  var _colors = require("@atlaskit/theme/colors");
19
19
  var _messages = require("./messages");
20
20
  var _syncInfo = require("./sync-info");
21
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
21
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
22
22
  /** @jsx jsx */
23
- var FooterWrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n padding: ", " 0;\n position: sticky;\n bottom: 0;\n background: ", ";\n border-top-style: solid;\n border-top-color: ", ";\n margin-top: -2px;\n align-self: center;\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-input, ".concat(_colors.N0, ")"), "var(--ds-background-neutral, ".concat(_colors.N40, ")"));
24
- var IssueCounterWrapper = _styled.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: 10px;\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"));
25
- var SyncWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N90, ")"));
26
- var SyncTextWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: 5px;\n"])));
23
+ var FooterWrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 ", ";\n box-sizing: border-box;\n background: ", ";\n"])), "var(--ds-space-200, 16px)", "var(--ds-background-input, ".concat(_colors.N0, ")"));
24
+ var TopBorderWrapper = _styled.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n box-sizing: border-box;\n justify-content: space-between;\n padding: ", " 0;\n border-top: 2px solid ", ";\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"));
25
+ var IssueCounterWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"));
26
+ var SyncWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N90, ")"));
27
+ var SyncTextWrapper = _styled.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: 5px;\n"])));
27
28
  var TableFooter = function TableFooter(_ref) {
28
29
  var issueCount = _ref.issueCount,
29
30
  onRefresh = _ref.onRefresh,
@@ -44,7 +45,9 @@ var TableFooter = function TableFooter(_ref) {
44
45
  // ensure correct positioning since 'justify-content: space-between' is used).
45
46
  return onRefresh || showIssueCount ? (0, _react2.jsx)(FooterWrapper, {
46
47
  "data-testid": "table-footer"
47
- }, (0, _react2.jsx)(IssueCounterWrapper, null, showIssueCount && (0, _react2.jsx)(_heading.default, {
48
+ }, (0, _react2.jsx)(TopBorderWrapper, null, (0, _react2.jsx)(IssueCounterWrapper, {
49
+ "data-testid": 'issue-count-wrapper'
50
+ }, showIssueCount && (0, _react2.jsx)(_heading.default, {
48
51
  testId: "issue-count",
49
52
  level: "h400"
50
53
  }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
@@ -65,6 +68,6 @@ var TableFooter = function TableFooter(_ref) {
65
68
  }),
66
69
  isDisabled: isLoading,
67
70
  testId: "refresh-button"
68
- })))) : null;
71
+ }))))) : null;
69
72
  };
70
73
  exports.TableFooter = TableFooter;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.1",
3
+ "version": "0.31.3",
4
4
  "sideEffects": false
5
5
  }
@@ -71,7 +71,7 @@ export const AssetsConfigModal = props => {
71
71
  return data === null || data === void 0 ? void 0 : (_data$key = data.key) === null || _data$key === void 0 ? void 0 : (_data$key$data = _data$key.data) === null || _data$key$data === void 0 ? void 0 : _data$key$data.url;
72
72
  }, [responseItems]);
73
73
  const onInsertPressed = useCallback(() => {
74
- if (!aql || !schemaId) {
74
+ if (!aql || !schemaId || !workspaceId) {
75
75
  return;
76
76
  }
77
77
  const firstAssetUrl = retrieveUrlForSmartCardRender();
@@ -89,8 +89,8 @@ export const AssetsConfigModal = props => {
89
89
  datasource: {
90
90
  id: datasourceId,
91
91
  parameters: {
92
- workspaceId: '',
93
- aql: aql,
92
+ workspaceId,
93
+ aql,
94
94
  schemaId
95
95
  },
96
96
  views: [{
@@ -105,7 +105,7 @@ export const AssetsConfigModal = props => {
105
105
  }
106
106
  });
107
107
  }
108
- }, [aql, datasourceId, onInsert, responseItems.length, retrieveUrlForSmartCardRender, schemaId, visibleColumnKeys]);
108
+ }, [aql, datasourceId, onInsert, responseItems.length, retrieveUrlForSmartCardRender, schemaId, workspaceId, visibleColumnKeys]);
109
109
  const handleOnSearch = useCallback((aql, schemaId) => {
110
110
  reset();
111
111
  setAql(aql);
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { useEffect } from 'react';
3
- import { css, jsx } from '@emotion/react';
3
+ import { jsx } from '@emotion/react';
4
4
  import { useDatasourceTableState } from '../../hooks/useDatasourceTableState';
5
5
  import { AccessRequired } from '../common/error-state/access-required';
6
6
  import { LoadingError } from '../common/error-state/loading-error';
@@ -8,13 +8,6 @@ import { NoResults } from '../common/error-state/no-results';
8
8
  import { IssueLikeDataTableView } from '../issue-like-table';
9
9
  import EmptyState from '../issue-like-table/empty-state';
10
10
  import { TableFooter } from '../table-footer';
11
- const TableViewWrapperStyles = css({
12
- display: 'grid',
13
- position: 'relative',
14
- padding: "var(--ds-space-200, 16px)",
15
- paddingBottom: 0,
16
- boxSizing: 'border-box'
17
- });
18
11
  export const DatasourceTableView = ({
19
12
  datasourceId,
20
13
  parameters,
@@ -59,9 +52,8 @@ export const DatasourceTableView = ({
59
52
  onRefresh: reset
60
53
  });
61
54
  }
62
- return columns.length > 0 ? jsx("div", {
63
- css: TableViewWrapperStyles
64
- }, jsx(IssueLikeDataTableView, {
55
+ const isDataReady = columns.length > 0;
56
+ return jsx("div", null, isDataReady ? jsx(IssueLikeDataTableView, {
65
57
  testId: 'datasource-table-view',
66
58
  hasNextPage: hasNextPage,
67
59
  items: responseItems,
@@ -70,18 +62,14 @@ export const DatasourceTableView = ({
70
62
  status: status,
71
63
  columns: columns,
72
64
  visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
73
- onVisibleColumnKeysChange: onVisibleColumnKeysChange
74
- }), jsx(TableFooter, {
75
- issueCount: totalCount,
76
- onRefresh: reset,
77
- isLoading: status === 'loading'
78
- })) : jsx("div", {
79
- css: TableViewWrapperStyles
80
- }, jsx(EmptyState, {
65
+ onVisibleColumnKeysChange: onVisibleColumnKeysChange,
66
+ scrollableContainerHeight: 590
67
+ }) : jsx(EmptyState, {
81
68
  testId: "datasource-table-view-skeleton",
82
69
  isCompact: true
83
70
  }), jsx(TableFooter, {
71
+ issueCount: isDataReady ? totalCount : undefined,
84
72
  onRefresh: reset,
85
- isLoading: true
73
+ isLoading: !isDataReady || status === 'loading'
86
74
  }));
87
75
  };
@@ -9,7 +9,6 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
9
9
  import { CheckboxOption, PopupSelect } from '@atlaskit/select';
10
10
  import { columnPickerMessages } from './messages';
11
11
  export const ColumnPicker = ({
12
- isDatasourceLoading,
13
12
  columns,
14
13
  selectedColumnKeys,
15
14
  onSelectedColumnKeysChange,
@@ -102,8 +101,7 @@ export const ColumnPicker = ({
102
101
  })),
103
102
  spacing: "compact",
104
103
  appearance: "subtle",
105
- testId: "column-picker-trigger-button",
106
- isDisabled: isDatasourceLoading
104
+ testId: "column-picker-trigger-button"
107
105
  }))
108
106
  });
109
107
  };
@@ -0,0 +1,46 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { css, jsx } from '@emotion/react';
4
+ import styled from '@emotion/styled';
5
+ import { TableHeading } from './styled';
6
+ const maxWidth = '200px';
7
+ const firstLastChildOverride = `
8
+ &:first-of-type, &:last-of-type {
9
+ padding-left: ${"var(--ds-space-100, 8px)"};
10
+ padding-right: ${"var(--ds-space-100, 8px)"};
11
+ }
12
+ `;
13
+ const TablePreviewHeading = styled(TableHeading)`
14
+ overflow: hidden;
15
+ text-overflow: ellipsis;
16
+ white-space: nowrap;
17
+ background: ${"var(--ds-background-disabled, #091E4224)"};
18
+ color: ${"var(--ds-text-disabled, #091E424F)"};
19
+ max-width: ${maxWidth};
20
+ ${firstLastChildOverride}
21
+ `;
22
+ const TablePreviewCell = styled.td`
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ white-space: nowrap;
26
+ max-width: ${maxWidth};
27
+ padding: ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"};
28
+ ${firstLastChildOverride}
29
+ `;
30
+ const tableStyles = css({
31
+ background: "var(--ds-surface, #FFF)",
32
+ borderCollapse: 'separate',
33
+ borderSpacing: 0,
34
+ fontSize: "var(--ds-font-size-200, 16px)",
35
+ maxWidth
36
+ });
37
+ export const DragColumnPreview = ({
38
+ title,
39
+ rows
40
+ }) => {
41
+ return jsx("table", {
42
+ css: tableStyles
43
+ }, jsx("thead", null, jsx("tr", null, jsx(TablePreviewHeading, null, title))), jsx("tbody", null, rows.map((data, i) => jsx("tr", {
44
+ key: i
45
+ }, jsx(TablePreviewCell, null, data))), jsx("tr", null, jsx(TablePreviewCell, null, "..."))));
46
+ };
@@ -1,16 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
+ import ReactDOM from 'react-dom';
4
5
  import invariant from 'tiny-invariant';
5
6
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
6
7
  import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
7
8
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal';
8
9
  import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
9
10
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
11
+ import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
12
+ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
10
13
  import { TableHeading } from './styled';
11
- const tableHeadingStyles = css({
12
- cursor: 'grab'
13
- });
14
14
  const tableHeadingStatusStyles = {
15
15
  idle: css({
16
16
  ':hover': {
@@ -30,7 +30,14 @@ const verticallyAlignedStyles = css({
30
30
  const dragHandleStyles = css({
31
31
  position: 'relative',
32
32
  display: 'flex',
33
- alignItems: 'center'
33
+ alignItems: 'center',
34
+ overflow: 'hidden',
35
+ width: 0,
36
+ transition: 'width 0.5s'
37
+ });
38
+ const dragHandleSpacerStyles = css({
39
+ width: 24,
40
+ transition: 'width 0.5s'
34
41
  });
35
42
  const dropTargetStyles = css({
36
43
  position: 'absolute',
@@ -41,18 +48,23 @@ const dropTargetStyles = css({
41
48
  const noPointerEventsStyles = css({
42
49
  pointerEvents: 'none'
43
50
  });
51
+ const idleState = {
52
+ type: 'idle'
53
+ };
54
+ const draggingState = {
55
+ type: 'dragging'
56
+ };
44
57
  export const DraggableTableHeading = ({
45
58
  children,
46
59
  id,
47
60
  index,
48
61
  tableId,
49
62
  dndPreviewHeight,
50
- maxWidth,
51
- onDragPreviewStart,
52
- onDragPreviewEnd
63
+ dragPreview,
64
+ maxWidth
53
65
  }) => {
54
66
  const ref = useRef(null);
55
- const [status, setStatus] = useState('idle');
67
+ const [state, setState] = useState(idleState);
56
68
  const [isDraggingAnyColumn, setIsDraggingAnyColumn] = useState(false);
57
69
  const [closestEdge, setClosestEdge] = useState(null);
58
70
  const dropTargetRef = useRef(null);
@@ -69,19 +81,38 @@ export const DraggableTableHeading = ({
69
81
  tableId
70
82
  };
71
83
  },
72
- onGenerateDragPreview() {
73
- setStatus('preview');
74
- onDragPreviewStart();
84
+ onGenerateDragPreview({
85
+ nativeSetDragImage
86
+ }) {
87
+ setCustomNativeDragPreview({
88
+ getOffset: offsetFromPointer({
89
+ x: '18px',
90
+ y: '18px'
91
+ }),
92
+ render: ({
93
+ container
94
+ }) => {
95
+ // Cause a `react` re-render to create your portal synchronously
96
+ setState({
97
+ type: 'preview',
98
+ container
99
+ });
100
+ // In our cleanup function: cause a `react` re-render to create remove your portal
101
+ // Note: you can also remove the portal in `onDragStart`,
102
+ // which is when the cleanup function is called
103
+ return () => setState(draggingState);
104
+ },
105
+ nativeSetDragImage
106
+ });
75
107
  },
76
108
  onDragStart() {
77
- setStatus('dragging');
78
- onDragPreviewEnd();
109
+ setState(draggingState);
79
110
  },
80
111
  onDrop() {
81
- setStatus('idle');
112
+ setState(idleState);
82
113
  }
83
114
  }));
84
- }, [id, index, onDragPreviewEnd, onDragPreviewStart, tableId]);
115
+ }, [id, index, tableId]);
85
116
 
86
117
  // Here we handle drop target, that in our case is absolutely positioned div that covers full width and height
87
118
  // of this column (has height of whole table). It sits on top of everything, but has `pointerEvents: 'none'` by default
@@ -145,7 +176,7 @@ export const DraggableTableHeading = ({
145
176
  }, [tableId]);
146
177
  return jsx(TableHeading, {
147
178
  ref: ref,
148
- css: [tableHeadingStyles, tableHeadingStatusStyles[status]],
179
+ css: [tableHeadingStatusStyles[state.type]],
149
180
  "data-testid": `${id}-column-heading`,
150
181
  style: {
151
182
  maxWidth
@@ -162,9 +193,13 @@ export const DraggableTableHeading = ({
162
193
  })), jsx("div", {
163
194
  css: verticallyAlignedStyles
164
195
  }, jsx("div", {
165
- css: dragHandleStyles
196
+ css: dragHandleStyles,
197
+ className: "issue-like-table-drag-handle"
166
198
  }, jsx(DragHandlerIcon, {
167
199
  label: `${id}-drag-icon`,
168
200
  size: "medium"
169
- })), children));
201
+ })), children, jsx("div", {
202
+ css: dragHandleSpacerStyles,
203
+ className: "issue-like-table-drag-handle-spacer"
204
+ })), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
170
205
  };
@@ -5,6 +5,9 @@ import UserType from '../render-type/user';
5
5
  import { EmptyStateTableHeading } from '../styled';
6
6
  import Priority from './priority';
7
7
  import Type from './type';
8
+ const tableBodyStyles = css({
9
+ borderBottom: 0
10
+ });
8
11
  const baseColumns = [{
9
12
  key: 'type',
10
13
  width: 50
@@ -118,7 +121,9 @@ export default (({
118
121
  width: width,
119
122
  height: 13,
120
123
  borderRadius: 8
121
- }))))), jsx("tbody", null, rows.map(row => jsx("tr", {
124
+ }))))), jsx("tbody", {
125
+ css: tableBodyStyles
126
+ }, rows.map(row => jsx("tr", {
122
127
  key: row.id
123
128
  }, columnsToRender.map(column => jsx("td", {
124
129
  css: cellStyles,