@atlaskit/link-datasource 0.31.2 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -19
- package/dist/cjs/ui/issue-like-table/column-picker/index.js +2 -4
- package/dist/cjs/ui/issue-like-table/drag-column-preview.js +37 -0
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +60 -25
- package/dist/cjs/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/cjs/ui/issue-like-table/index.js +102 -71
- package/dist/cjs/ui/issue-like-table/styled.js +2 -1
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +12 -9
- package/dist/cjs/ui/table-footer/index.js +10 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -20
- package/dist/es2019/ui/issue-like-table/column-picker/index.js +1 -3
- package/dist/es2019/ui/issue-like-table/drag-column-preview.js +46 -0
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +53 -18
- package/dist/es2019/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/es2019/ui/issue-like-table/index.js +86 -43
- package/dist/es2019/ui/issue-like-table/styled.js +18 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +13 -10
- package/dist/es2019/ui/table-footer/index.js +11 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +8 -20
- package/dist/esm/ui/issue-like-table/column-picker/index.js +2 -4
- package/dist/esm/ui/issue-like-table/drag-column-preview.js +29 -0
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +60 -25
- package/dist/esm/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/esm/ui/issue-like-table/index.js +102 -71
- package/dist/esm/ui/issue-like-table/styled.js +2 -1
- package/dist/esm/ui/jira-issues-modal/modal/index.js +13 -10
- package/dist/esm/ui/table-footer/index.js +10 -7
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/issue-like-table/column-picker/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/column-picker/types.d.ts +0 -1
- package/dist/types/ui/issue-like-table/drag-column-preview.d.ts +7 -0
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/types.d.ts +5 -0
- package/dist/types-ts4.5/ui/issue-like-table/column-picker/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/column-picker/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/issue-like-table/drag-column-preview.d.ts +7 -0
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
- package/package.json +2 -2
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
2
3
|
export const Table = styled.table`
|
|
3
4
|
width: 100%;
|
|
4
5
|
`;
|
|
5
6
|
export const TableHeading = styled.th`
|
|
7
|
+
cursor: grab;
|
|
6
8
|
position: relative;
|
|
7
9
|
padding-block: ${"var(--ds-space-100, 8px)"};
|
|
8
10
|
line-height: ${"var(--ds-font-lineHeight-300, 24px)"};
|
|
11
|
+
border-bottom: 2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`};
|
|
12
|
+
.ProseMirror & h5,
|
|
13
|
+
& h5 {
|
|
14
|
+
margin-top: 0;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
line-height: 24px; /* Is needed to keep overall height consistent with or without drag handle icon present */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:hover .issue-like-table-drag-handle {
|
|
22
|
+
width: 24px;
|
|
23
|
+
}
|
|
24
|
+
&:hover .issue-like-table-drag-handle-spacer {
|
|
25
|
+
width: 0px;
|
|
26
|
+
}
|
|
9
27
|
`;
|
|
10
28
|
export const EmptyStateTableHeading = styled(TableHeading)`
|
|
11
29
|
&:first-child {
|
|
@@ -5,7 +5,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
|
|
6
6
|
import Button from '@atlaskit/button/standard-button';
|
|
7
7
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
8
|
-
import { B400, N0, N800 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { B400, N0, N40, N800 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
10
10
|
import { getAvailableJiraSites } from '../../../services/getAvailableJiraSites';
|
|
11
11
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
@@ -23,8 +23,9 @@ const dropdownContainerStyles = css({
|
|
|
23
23
|
});
|
|
24
24
|
const contentContainerStyles = css({
|
|
25
25
|
display: 'grid',
|
|
26
|
-
|
|
27
|
-
overflow: 'auto'
|
|
26
|
+
maxHeight: '420px',
|
|
27
|
+
overflow: 'auto',
|
|
28
|
+
borderBottom: `2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`}`
|
|
28
29
|
});
|
|
29
30
|
const placeholderSmartLinkStyles = css({
|
|
30
31
|
backgroundColor: `var(--ds-surface-raised, ${N0})`,
|
|
@@ -159,7 +160,9 @@ export const JiraIssuesConfigModal = props => {
|
|
|
159
160
|
const handleViewModeChange = selectedMode => {
|
|
160
161
|
setCurrentViewMode(selectedMode);
|
|
161
162
|
};
|
|
162
|
-
const issueLikeDataTableView = useMemo(() => jsx(
|
|
163
|
+
const issueLikeDataTableView = useMemo(() => jsx("div", {
|
|
164
|
+
css: contentContainerStyles
|
|
165
|
+
}, jsx(IssueLikeDataTableView, {
|
|
163
166
|
testId: "jira-jql-datasource-table",
|
|
164
167
|
status: status,
|
|
165
168
|
columns: columns,
|
|
@@ -169,7 +172,7 @@ export const JiraIssuesConfigModal = props => {
|
|
|
169
172
|
onNextPage: onNextPage,
|
|
170
173
|
onLoadDatasourceDetails: loadDatasourceDetails,
|
|
171
174
|
onVisibleColumnKeysChange: setVisibleColumnKeys
|
|
172
|
-
}), [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
|
|
175
|
+
})), [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
|
|
173
176
|
const renderCountModeContent = useCallback(() => {
|
|
174
177
|
const url = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
175
178
|
if (status === 'unauthorized') {
|
|
@@ -205,9 +208,11 @@ export const JiraIssuesConfigModal = props => {
|
|
|
205
208
|
return jsx(NoResults, null);
|
|
206
209
|
} else if (status === 'empty' || !columns.length) {
|
|
207
210
|
// persist the empty state when making the initial /data request which contains the columns
|
|
208
|
-
return jsx(
|
|
211
|
+
return jsx("div", {
|
|
212
|
+
css: contentContainerStyles
|
|
213
|
+
}, jsx(EmptyState, {
|
|
209
214
|
testId: `jira-jql-datasource-modal--empty-state`
|
|
210
|
-
});
|
|
215
|
+
}));
|
|
211
216
|
}
|
|
212
217
|
const firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
213
218
|
if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -250,9 +255,7 @@ export const JiraIssuesConfigModal = props => {
|
|
|
250
255
|
isSearching: status === 'loading',
|
|
251
256
|
parameters: parameters,
|
|
252
257
|
onSearch: onSearch
|
|
253
|
-
}), jsx("div", {
|
|
254
|
-
css: contentContainerStyles
|
|
255
|
-
}, currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent())), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
258
|
+
}), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
256
259
|
"data-testid": "jira-jql-datasource-modal-total-issues-count",
|
|
257
260
|
css: issueCountStyles
|
|
258
261
|
}, jsx(FormattedNumber, {
|
|
@@ -11,20 +11,18 @@ import { N0, N40, N800, N90 } from '@atlaskit/theme/colors';
|
|
|
11
11
|
import { footerMessages } from './messages';
|
|
12
12
|
import { SyncInfo } from './sync-info';
|
|
13
13
|
const FooterWrapper = styled.div`
|
|
14
|
+
padding: 0 ${"var(--ds-space-200, 16px)"};
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
background: ${`var(--ds-background-input, ${N0})`};
|
|
17
|
+
`;
|
|
18
|
+
const TopBorderWrapper = styled.div`
|
|
14
19
|
display: flex;
|
|
20
|
+
box-sizing: border-box;
|
|
15
21
|
justify-content: space-between;
|
|
16
|
-
width: 100%;
|
|
17
22
|
padding: ${"var(--ds-space-250, 20px)"} 0;
|
|
18
|
-
|
|
19
|
-
bottom: 0;
|
|
20
|
-
background: ${`var(--ds-background-input, ${N0})`};
|
|
21
|
-
border-top-style: solid;
|
|
22
|
-
border-top-color: ${`var(--ds-background-neutral, ${N40})`};
|
|
23
|
-
margin-top: -2px;
|
|
24
|
-
align-self: center;
|
|
23
|
+
border-top: 2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`};
|
|
25
24
|
`;
|
|
26
25
|
const IssueCounterWrapper = styled.div`
|
|
27
|
-
margin-left: 10px;
|
|
28
26
|
display: flex;
|
|
29
27
|
align-self: center;
|
|
30
28
|
color: ${`var(--ds-text-accent-gray, ${N800})`};
|
|
@@ -55,7 +53,9 @@ export const TableFooter = ({
|
|
|
55
53
|
// ensure correct positioning since 'justify-content: space-between' is used).
|
|
56
54
|
return onRefresh || showIssueCount ? jsx(FooterWrapper, {
|
|
57
55
|
"data-testid": "table-footer"
|
|
58
|
-
}, jsx(
|
|
56
|
+
}, jsx(TopBorderWrapper, null, jsx(IssueCounterWrapper, {
|
|
57
|
+
"data-testid": 'issue-count-wrapper'
|
|
58
|
+
}, showIssueCount && jsx(Heading, {
|
|
59
59
|
testId: "issue-count",
|
|
60
60
|
level: "h400"
|
|
61
61
|
}, jsx(FormattedNumber, {
|
|
@@ -76,5 +76,5 @@ export const TableFooter = ({
|
|
|
76
76
|
}),
|
|
77
77
|
isDisabled: isLoading,
|
|
78
78
|
testId: "refresh-button"
|
|
79
|
-
})))) : null;
|
|
79
|
+
}))))) : null;
|
|
80
80
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import {
|
|
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
|
-
var 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 var DatasourceTableView = function DatasourceTableView(_ref) {
|
|
19
12
|
var datasourceId = _ref.datasourceId,
|
|
20
13
|
parameters = _ref.parameters,
|
|
@@ -57,9 +50,8 @@ export var DatasourceTableView = function DatasourceTableView(_ref) {
|
|
|
57
50
|
onRefresh: reset
|
|
58
51
|
});
|
|
59
52
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, jsx(IssueLikeDataTableView, {
|
|
53
|
+
var isDataReady = columns.length > 0;
|
|
54
|
+
return jsx("div", null, isDataReady ? jsx(IssueLikeDataTableView, {
|
|
63
55
|
testId: 'datasource-table-view',
|
|
64
56
|
hasNextPage: hasNextPage,
|
|
65
57
|
items: responseItems,
|
|
@@ -68,18 +60,14 @@ export var DatasourceTableView = function DatasourceTableView(_ref) {
|
|
|
68
60
|
status: status,
|
|
69
61
|
columns: columns,
|
|
70
62
|
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
71
|
-
onVisibleColumnKeysChange: onVisibleColumnKeysChange
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onRefresh: reset,
|
|
75
|
-
isLoading: status === 'loading'
|
|
76
|
-
})) : jsx("div", {
|
|
77
|
-
css: TableViewWrapperStyles
|
|
78
|
-
}, jsx(EmptyState, {
|
|
63
|
+
onVisibleColumnKeysChange: onVisibleColumnKeysChange,
|
|
64
|
+
scrollableContainerHeight: 590
|
|
65
|
+
}) : jsx(EmptyState, {
|
|
79
66
|
testId: "datasource-table-view-skeleton",
|
|
80
67
|
isCompact: true
|
|
81
68
|
}), jsx(TableFooter, {
|
|
69
|
+
issueCount: isDataReady ? totalCount : undefined,
|
|
82
70
|
onRefresh: reset,
|
|
83
|
-
isLoading:
|
|
71
|
+
isLoading: !isDataReady || status === 'loading'
|
|
84
72
|
}));
|
|
85
73
|
};
|
|
@@ -13,8 +13,7 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
|
13
13
|
import { CheckboxOption, PopupSelect } from '@atlaskit/select';
|
|
14
14
|
import { columnPickerMessages } from './messages';
|
|
15
15
|
export var ColumnPicker = function ColumnPicker(_ref) {
|
|
16
|
-
var
|
|
17
|
-
columns = _ref.columns,
|
|
16
|
+
var columns = _ref.columns,
|
|
18
17
|
selectedColumnKeys = _ref.selectedColumnKeys,
|
|
19
18
|
onSelectedColumnKeysChange = _ref.onSelectedColumnKeysChange,
|
|
20
19
|
onOpen = _ref.onOpen;
|
|
@@ -120,8 +119,7 @@ export var ColumnPicker = function ColumnPicker(_ref) {
|
|
|
120
119
|
})),
|
|
121
120
|
spacing: "compact",
|
|
122
121
|
appearance: "subtle",
|
|
123
|
-
testId: "column-picker-trigger-button"
|
|
124
|
-
isDisabled: isDatasourceLoading
|
|
122
|
+
testId: "column-picker-trigger-button"
|
|
125
123
|
}));
|
|
126
124
|
}
|
|
127
125
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import styled from '@emotion/styled';
|
|
7
|
+
import { TableHeading } from './styled';
|
|
8
|
+
var maxWidth = '200px';
|
|
9
|
+
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);
|
|
12
|
+
var tableStyles = css({
|
|
13
|
+
background: "var(--ds-surface, #FFF)",
|
|
14
|
+
borderCollapse: 'separate',
|
|
15
|
+
borderSpacing: 0,
|
|
16
|
+
fontSize: "var(--ds-font-size-200, 16px)",
|
|
17
|
+
maxWidth: maxWidth
|
|
18
|
+
});
|
|
19
|
+
export var DragColumnPreview = function DragColumnPreview(_ref) {
|
|
20
|
+
var title = _ref.title,
|
|
21
|
+
rows = _ref.rows;
|
|
22
|
+
return jsx("table", {
|
|
23
|
+
css: tableStyles
|
|
24
|
+
}, jsx("thead", null, jsx("tr", null, jsx(TablePreviewHeading, null, title))), jsx("tbody", null, rows.map(function (data, i) {
|
|
25
|
+
return jsx("tr", {
|
|
26
|
+
key: i
|
|
27
|
+
}, jsx(TablePreviewCell, null, data));
|
|
28
|
+
}), jsx("tr", null, jsx(TablePreviewCell, null, "..."))));
|
|
29
|
+
};
|
|
@@ -2,16 +2,16 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
5
6
|
import invariant from 'tiny-invariant';
|
|
6
7
|
import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
|
|
7
8
|
import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
|
|
8
9
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal';
|
|
9
10
|
import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
10
11
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
12
|
+
import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
|
|
13
|
+
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
11
14
|
import { TableHeading } from './styled';
|
|
12
|
-
var tableHeadingStyles = css({
|
|
13
|
-
cursor: 'grab'
|
|
14
|
-
});
|
|
15
15
|
var tableHeadingStatusStyles = {
|
|
16
16
|
idle: css({
|
|
17
17
|
':hover': {
|
|
@@ -31,7 +31,14 @@ var verticallyAlignedStyles = css({
|
|
|
31
31
|
var dragHandleStyles = css({
|
|
32
32
|
position: 'relative',
|
|
33
33
|
display: 'flex',
|
|
34
|
-
alignItems: 'center'
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
overflow: 'hidden',
|
|
36
|
+
width: 0,
|
|
37
|
+
transition: 'width 0.5s'
|
|
38
|
+
});
|
|
39
|
+
var dragHandleSpacerStyles = css({
|
|
40
|
+
width: 24,
|
|
41
|
+
transition: 'width 0.5s'
|
|
35
42
|
});
|
|
36
43
|
var dropTargetStyles = css({
|
|
37
44
|
position: 'absolute',
|
|
@@ -42,20 +49,25 @@ var dropTargetStyles = css({
|
|
|
42
49
|
var noPointerEventsStyles = css({
|
|
43
50
|
pointerEvents: 'none'
|
|
44
51
|
});
|
|
52
|
+
var idleState = {
|
|
53
|
+
type: 'idle'
|
|
54
|
+
};
|
|
55
|
+
var draggingState = {
|
|
56
|
+
type: 'dragging'
|
|
57
|
+
};
|
|
45
58
|
export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
46
59
|
var children = _ref.children,
|
|
47
60
|
id = _ref.id,
|
|
48
61
|
index = _ref.index,
|
|
49
62
|
tableId = _ref.tableId,
|
|
50
63
|
dndPreviewHeight = _ref.dndPreviewHeight,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onDragPreviewEnd = _ref.onDragPreviewEnd;
|
|
64
|
+
dragPreview = _ref.dragPreview,
|
|
65
|
+
maxWidth = _ref.maxWidth;
|
|
54
66
|
var ref = useRef(null);
|
|
55
|
-
var _useState = useState(
|
|
67
|
+
var _useState = useState(idleState),
|
|
56
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
state = _useState2[0],
|
|
70
|
+
setState = _useState2[1];
|
|
59
71
|
var _useState3 = useState(false),
|
|
60
72
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
61
73
|
isDraggingAnyColumn = _useState4[0],
|
|
@@ -78,19 +90,38 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
78
90
|
tableId: tableId
|
|
79
91
|
};
|
|
80
92
|
},
|
|
81
|
-
onGenerateDragPreview: function onGenerateDragPreview() {
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref2) {
|
|
94
|
+
var nativeSetDragImage = _ref2.nativeSetDragImage;
|
|
95
|
+
setCustomNativeDragPreview({
|
|
96
|
+
getOffset: offsetFromPointer({
|
|
97
|
+
x: '18px',
|
|
98
|
+
y: '18px'
|
|
99
|
+
}),
|
|
100
|
+
render: function render(_ref3) {
|
|
101
|
+
var container = _ref3.container;
|
|
102
|
+
// Cause a `react` re-render to create your portal synchronously
|
|
103
|
+
setState({
|
|
104
|
+
type: 'preview',
|
|
105
|
+
container: container
|
|
106
|
+
});
|
|
107
|
+
// In our cleanup function: cause a `react` re-render to create remove your portal
|
|
108
|
+
// Note: you can also remove the portal in `onDragStart`,
|
|
109
|
+
// which is when the cleanup function is called
|
|
110
|
+
return function () {
|
|
111
|
+
return setState(draggingState);
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
nativeSetDragImage: nativeSetDragImage
|
|
115
|
+
});
|
|
84
116
|
},
|
|
85
117
|
onDragStart: function onDragStart() {
|
|
86
|
-
|
|
87
|
-
onDragPreviewEnd();
|
|
118
|
+
setState(draggingState);
|
|
88
119
|
},
|
|
89
120
|
onDrop: function onDrop() {
|
|
90
|
-
|
|
121
|
+
setState(idleState);
|
|
91
122
|
}
|
|
92
123
|
}));
|
|
93
|
-
}, [id, index,
|
|
124
|
+
}, [id, index, tableId]);
|
|
94
125
|
|
|
95
126
|
// Here we handle drop target, that in our case is absolutely positioned div that covers full width and height
|
|
96
127
|
// of this column (has height of whole table). It sits on top of everything, but has `pointerEvents: 'none'` by default
|
|
@@ -102,9 +133,9 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
102
133
|
getIsSticky: function getIsSticky() {
|
|
103
134
|
return true;
|
|
104
135
|
},
|
|
105
|
-
getData: function getData(
|
|
106
|
-
var input =
|
|
107
|
-
element =
|
|
136
|
+
getData: function getData(_ref4) {
|
|
137
|
+
var input = _ref4.input,
|
|
138
|
+
element = _ref4.element;
|
|
108
139
|
var data = {
|
|
109
140
|
id: id,
|
|
110
141
|
index: index
|
|
@@ -135,8 +166,8 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
135
166
|
// During dragging anywhere we want to remove `pointerEvents: 'none'` from all the drop targets
|
|
136
167
|
useEffect(function () {
|
|
137
168
|
return monitorForElements({
|
|
138
|
-
canMonitor: function canMonitor(
|
|
139
|
-
var source =
|
|
169
|
+
canMonitor: function canMonitor(_ref5) {
|
|
170
|
+
var source = _ref5.source;
|
|
140
171
|
return source.data.type === 'table-header' && source.data.tableId === tableId;
|
|
141
172
|
},
|
|
142
173
|
onDragStart: function onDragStart() {
|
|
@@ -152,7 +183,7 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
152
183
|
}, [tableId]);
|
|
153
184
|
return jsx(TableHeading, {
|
|
154
185
|
ref: ref,
|
|
155
|
-
css: [
|
|
186
|
+
css: [tableHeadingStatusStyles[state.type]],
|
|
156
187
|
"data-testid": "".concat(id, "-column-heading"),
|
|
157
188
|
style: {
|
|
158
189
|
maxWidth: maxWidth
|
|
@@ -169,9 +200,13 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
169
200
|
})), jsx("div", {
|
|
170
201
|
css: verticallyAlignedStyles
|
|
171
202
|
}, jsx("div", {
|
|
172
|
-
css: dragHandleStyles
|
|
203
|
+
css: dragHandleStyles,
|
|
204
|
+
className: "issue-like-table-drag-handle"
|
|
173
205
|
}, jsx(DragHandlerIcon, {
|
|
174
206
|
label: "".concat(id, "-drag-icon"),
|
|
175
207
|
size: "medium"
|
|
176
|
-
})), children
|
|
208
|
+
})), children, jsx("div", {
|
|
209
|
+
css: dragHandleSpacerStyles,
|
|
210
|
+
className: "issue-like-table-drag-handle-spacer"
|
|
211
|
+
})), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
|
|
177
212
|
};
|
|
@@ -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
|
+
var tableBodyStyles = css({
|
|
9
|
+
borderBottom: 0
|
|
10
|
+
});
|
|
8
11
|
var baseColumns = [{
|
|
9
12
|
key: 'type',
|
|
10
13
|
width: 50
|
|
@@ -118,7 +121,9 @@ export default (function (_ref3) {
|
|
|
118
121
|
height: 13,
|
|
119
122
|
borderRadius: 8
|
|
120
123
|
}));
|
|
121
|
-
}))), jsx("tbody",
|
|
124
|
+
}))), jsx("tbody", {
|
|
125
|
+
css: tableBodyStyles
|
|
126
|
+
}, rows.map(function (row) {
|
|
122
127
|
return jsx("tr", {
|
|
123
128
|
key: row.id
|
|
124
129
|
}, columnsToRender.map(function (column) {
|